mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-18 00:32:11 +01:00
Add comment about comparing status strings
This commit is contained in:
1 parent
c499f03bc7
commit
44e99d79cf
3 files changed
+5
-3
No files matched your search
@@ -104,7 +104,8 @@ typedef struct {
|
||||
// is not localized, and does not contain additional contextual information
|
||||
// such as a source filename.
|
||||
//
|
||||
// Status strings are statically allocated and should never be free'd.
|
||||
// Status strings are statically allocated and should never be free'd. They can
|
||||
// be compared by the == operator and not just by strcmp.
|
||||
typedef const char* wuffs_base__status;
|
||||
|
||||
// !! INSERT wuffs_base__status names.
|
||||
|
||||
@@ -22,7 +22,7 @@ const baseBasePublicH = "" +
|
||||
"nt.com/nothings/stb/master/docs/stb_howto.txt\n#ifdef WUFFS_CONFIG__STATIC_FUNCTIONS\n#define WUFFS_BASE__MAYBE_STATIC static\n#else\n#define WUFFS_BASE__MAYBE_STATIC\n#endif\n\n// Clang also defines \"__GNUC__\".\n#if defined(__GNUC__)\n#define WUFFS_BASE__WARN_UNUSED_RESULT __attribute__((warn_unused_result))\n#else\n#define WUFFS_BASE__WARN_UNUSED_RESULT\n#endif\n\n// wuffs_base__empty_struct is used when a Wuffs function returns an empty\n// struct. In C, if a function f returns void, you can't say \"x = f()\", but in\n// Wuffs, if a function g returns empty, you can say \"y = g()\".\ntypedef struct {\n // private_impl is a placeholder field. It isn't explicitly used, except that\n // without it, the sizeof a struct with no fields can differ across C/C++\n // compilers, and it is undefined behavior in C99. For example, gcc says that\n // the sizeof an empty struct is 0, and g++ says that it is 1. This leads to\n // ABI incompatibility if a Wuffs .c file is processed by one compiler and\n // its .h file with another compiler.\n " +
|
||||
"//\n // Instead, we explicitly insert an otherwise unused field, so that the\n // sizeof this struct is always 1.\n uint8_t private_impl;\n} wuffs_base__empty_struct;\n\n// wuffs_base__utility is a placeholder receiver type. It enables what Java\n// calls static methods, as opposed to regular methods.\ntypedef struct {\n // private_impl is a placeholder field. It isn't explicitly used, except that\n // without it, the sizeof a struct with no fields can differ across C/C++\n // compilers, and it is undefined behavior in C99. For example, gcc says that\n // the sizeof an empty struct is 0, and g++ says that it is 1. This leads to\n // ABI incompatibility if a Wuffs .c file is processed by one compiler and\n // its .h file with another compiler.\n //\n // Instead, we explicitly insert an otherwise unused field, so that the\n // sizeof this struct is always 1.\n uint8_t private_impl;\n} wuffs_base__utility;\n\n" +
|
||||
"" +
|
||||
"// --------\n\n// A status is either NULL (meaning OK or no error) or string message. That\n// message is human-readable, for programmers, but it is not for end users. It\n// is not localized, and does not contain additional contextual information\n// such as a source filename.\n//\n// Status strings are statically allocated and should never be free'd.\ntypedef const char* wuffs_base__status;\n\n// !! INSERT wuffs_base__status names.\n\nstatic inline bool //\nwuffs_base__status__is_error(wuffs_base__status z) {\n return z && (*z != '$');\n}\n\nstatic inline bool //\nwuffs_base__status__is_ok(wuffs_base__status z) {\n return z == NULL;\n}\n\nstatic inline bool //\nwuffs_base__status__is_suspension(wuffs_base__status z) {\n return z && (*z == '$');\n}\n\n" +
|
||||
"// --------\n\n// A status is either NULL (meaning OK or no error) or string message. That\n// message is human-readable, for programmers, but it is not for end users. It\n// is not localized, and does not contain additional contextual information\n// such as a source filename.\n//\n// Status strings are statically allocated and should never be free'd. They can\n// be compared by the == operator and not just by strcmp.\ntypedef const char* wuffs_base__status;\n\n// !! INSERT wuffs_base__status names.\n\nstatic inline bool //\nwuffs_base__status__is_error(wuffs_base__status z) {\n return z && (*z != '$');\n}\n\nstatic inline bool //\nwuffs_base__status__is_ok(wuffs_base__status z) {\n return z == NULL;\n}\n\nstatic inline bool //\nwuffs_base__status__is_suspension(wuffs_base__status z) {\n return z && (*z == '$');\n}\n\n" +
|
||||
"" +
|
||||
"// --------\n\n// Flicks are a unit of time. One flick (frame-tick) is 1 / 705_600_000 of a\n// second. See https://github.com/OculusVR/Flicks\ntypedef int64_t wuffs_base__flicks;\n\n#define WUFFS_BASE__FLICKS_PER_SECOND ((uint64_t)705600000)\n#define WUFFS_BASE__FLICKS_PER_MILLISECOND ((uint64_t)705600)\n\n" +
|
||||
"" +
|
||||
|
||||
@@ -128,7 +128,8 @@ typedef struct {
|
||||
// is not localized, and does not contain additional contextual information
|
||||
// such as a source filename.
|
||||
//
|
||||
// Status strings are statically allocated and should never be free'd.
|
||||
// Status strings are statically allocated and should never be free'd. They can
|
||||
// be compared by the == operator and not just by strcmp.
|
||||
typedef const char* wuffs_base__status;
|
||||
|
||||
extern const char* wuffs_base__error__bad_wuffs_version;
|
||||
|
||||
Reference in new issue
Block a user