diff options
author | Denis Kenzior <denkenz@gmail.com> | 2009-06-15 17:41:50 -0500 |
---|---|---|
committer | Denis Kenzior <denkenz@gmail.com> | 2009-06-16 16:38:24 -0500 |
commit | b648a112f2d2a01b2f7adb7b847ce1731601952d (patch) | |
tree | 0b145b3538373de109a17cefd9d55b3549b5c72e /gatchat/gatresult.h | |
parent | 69372e642ed063d15dec6662984b7699640a4e11 (diff) | |
download | ofono-b648a112f2d2a01b2f7adb7b847ce1731601952d.tar.bz2 |
Improve string parsing code
Currently next_string and next_hexstring functions use a static
buffer in the iterator to store the value. This value is clobbered
as soon as next_string or next_hexstring is called. Instead,
we copy the entire line in iter_next and use it as a scratch buffer.
The only limitation is that lines of max 2048 are possible, however
these are limited to around this size by parts of the standard.
Diffstat (limited to 'gatchat/gatresult.h')
-rw-r--r-- | gatchat/gatresult.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/gatchat/gatresult.h b/gatchat/gatresult.h index cbe6d050..fc4c123c 100644 --- a/gatchat/gatresult.h +++ b/gatchat/gatresult.h @@ -33,10 +33,12 @@ struct _GAtResult { typedef struct _GAtResult GAtResult; +#define G_AT_RESULT_LINE_LENGTH_MAX 2048 + struct _GAtResultIter { GAtResult *result; GSList *l; - char buf[2048]; + char buf[G_AT_RESULT_LINE_LENGTH_MAX + 1]; unsigned int line_pos; GSList pre; }; |