From 249d8fcee6079aeef5bce1d2cfdc25c6454d1f0a Mon Sep 17 00:00:00 2001 From: John Mark Bell Date: Thu, 20 Nov 2008 23:30:21 +0000 Subject: Make integer_from_css_string return the number of input bytes processed. svn path=/trunk/libcss/; revision=5758 --- src/utils/utils.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/utils') diff --git a/src/utils/utils.h b/src/utils/utils.h index d31278d..b165059 100644 --- a/src/utils/utils.h +++ b/src/utils/utils.h @@ -27,14 +27,15 @@ #define UNUSED(x) ((x)=(x)) #endif -static inline int32_t integer_from_css_string(const css_string *string) +static inline int32_t integer_from_css_string(const css_string *string, + size_t *consumed) { size_t len; const uint8_t *ptr; int sign = 1; int32_t val = 0; - if (string == NULL || string->len == 0) + if (string == NULL || string->len == 0 || consumed == NULL) return 0; len = string->len; @@ -64,6 +65,8 @@ static inline int32_t integer_from_css_string(const css_string *string) len--; } + *consumed = ptr - string->ptr; + return val * sign; } -- cgit v1.2.3