summaryrefslogtreecommitdiff
path: root/core/upb.h
diff options
context:
space:
mode:
authorJoshua Haberman <joshua@reverberate.org>2011-01-21 17:29:16 -0800
committerJoshua Haberman <joshua@reverberate.org>2011-01-21 17:29:16 -0800
commit1dea81b1c244d357a6e46ee22c14b36280bf2100 (patch)
tree49a6d7159dd8551156f20170a79c3988c7a082b3 /core/upb.h
parenta38742bbe1cbc037f15edc053f5cf4dd53c5457a (diff)
Interface refinement: rename some constants.
* UPB_STOP -> UPB_BREAK, better represents breaking out of a parsing loop. * UPB_STATUS_OK -> UPB_OK, for all status codes, more concise at no readability cost (perhaps an improvement).
Diffstat (limited to 'core/upb.h')
-rw-r--r--core/upb.h16
1 files changed, 8 insertions, 8 deletions
diff --git a/core/upb.h b/core/upb.h
index fb6d9ea..d394a08 100644
--- a/core/upb.h
+++ b/core/upb.h
@@ -291,16 +291,16 @@ INLINE void upb_value_write(upb_valueptr ptr, upb_value val,
// resumed.
enum upb_status_code {
// The operation completed successfully.
- UPB_STATUS_OK = 0,
+ UPB_OK = 0,
// The bytesrc is at EOF and all data was read successfully.
- UPB_STATUS_EOF = 1,
+ UPB_EOF = 1,
// A read or write from a streaming src/sink could not be completed right now.
- UPB_STATUS_TRYAGAIN = 2,
+ UPB_TRYAGAIN = 2,
// An unrecoverable error occurred.
- UPB_STATUS_ERROR = -1,
+ UPB_ERROR = -1,
// A recoverable error occurred (for example, data of the wrong type was
// encountered which we can skip over).
@@ -308,21 +308,21 @@ enum upb_status_code {
};
// TODO: consider adding error space and code, to let ie. errno be stored
-// as a proper code.
+// as a proper code, or application-specific error codes.
typedef struct {
char code;
upb_string *str;
} upb_status;
-#define UPB_STATUS_INIT {UPB_STATUS_OK, NULL}
+#define UPB_STATUS_INIT {UPB_OK, NULL}
#define UPB_ERRORMSG_MAXLEN 256
INLINE bool upb_ok(upb_status *status) {
- return status->code == UPB_STATUS_OK;
+ return status->code == UPB_OK;
}
INLINE void upb_status_init(upb_status *status) {
- status->code = UPB_STATUS_OK;
+ status->code = UPB_OK;
status->str = NULL;
}
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback