From 1dea81b1c244d357a6e46ee22c14b36280bf2100 Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Fri, 21 Jan 2011 17:29:16 -0800 Subject: 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). --- core/upb.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'core/upb.h') 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; } -- cgit v1.2.3