diff options
author | Joshua Haberman <jhaberman@gmail.com> | 2012-03-31 12:17:32 -0700 |
---|---|---|
committer | Joshua Haberman <jhaberman@gmail.com> | 2012-03-31 12:17:32 -0700 |
commit | cca4818eb7769d6e776bdc30516a5f871f1d6393 (patch) | |
tree | e67dd65d5c016028ae976b09b2d69f6b7525aa5f /upb/upb.c | |
parent | 26ed1e996171c8ffa2ced42ac69b1b82c1956e1f (diff) |
Sync from internal Google development.
Diffstat (limited to 'upb/upb.c')
-rw-r--r-- | upb/upb.c | 34 |
1 files changed, 0 insertions, 34 deletions
@@ -91,40 +91,6 @@ void upb_status_setcode(upb_status *status, upb_errorspace *space, int code) { status->str = NULL; } -void upb_status_fromerrno(upb_status *status) { - if (errno != 0 && !upb_errno_is_wouldblock()) { - status->error = true; - upb_status_setcode(status, &upb_posix_errorspace, errno); - } -} - -bool upb_errno_is_wouldblock() { - return -#ifdef EAGAIN - errno == EAGAIN || -#endif -#ifdef EWOULDBLOCK - errno == EWOULDBLOCK || -#endif - false; -} - -bool upb_posix_codetostr(int code, char *buf, size_t len) { - if (strerror_r(code, buf, len) == -1) { - if (errno == EINVAL) { - size_t actual_len = - snprintf(buf, len, "Invalid POSIX error number %d\n", code); - return actual_len >= len; - } else if (errno == ERANGE) { - return false; - } - assert(false); - } - return true; -} - -upb_errorspace upb_posix_errorspace = {"POSIX", &upb_posix_codetostr}; - int upb_vrprintf(char **buf, size_t *size, size_t ofs, const char *fmt, va_list args) { // Try once without reallocating. We have to va_copy because we might have |