summaryrefslogtreecommitdiff
path: root/src/internal/intparse.h
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2011-07-14 00:51:45 -0400
committerRich Felker <dalias@aerifal.cx>2011-07-14 00:51:45 -0400
commitecc9c5fcfa4831b290cc1a63c0346cbb0c1fcf42 (patch)
tree2fb20d623af9622cb8ac9f461e542ca23fc6d791 /src/internal/intparse.h
parent0e2331c9b6e0c0b4f24019d4062f4c655d28cbaf (diff)
downloadmusl-ecc9c5fcfa4831b290cc1a63c0346cbb0c1fcf42.tar.gz
musl-ecc9c5fcfa4831b290cc1a63c0346cbb0c1fcf42.tar.bz2
musl-ecc9c5fcfa4831b290cc1a63c0346cbb0c1fcf42.tar.xz
musl-ecc9c5fcfa4831b290cc1a63c0346cbb0c1fcf42.zip
new restartable integer parsing framework.
this fixes a number of bugs in integer parsing due to lazy haphazard wrapping, as well as some misinterpretations of the standard. the new parser is able to work character-at-a-time or on whole strings, making it easy to support the wide functions without unbounded space for conversion. it will also be possible to update scanf to use the new parser.
Diffstat (limited to 'src/internal/intparse.h')
-rw-r--r--src/internal/intparse.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/internal/intparse.h b/src/internal/intparse.h
new file mode 100644
index 00000000..78e800d1
--- /dev/null
+++ b/src/internal/intparse.h
@@ -0,0 +1,11 @@
+#include <stdint.h>
+#include <stddef.h>
+
+struct intparse {
+ uintmax_t val;
+ unsigned small;
+ size_t cnt;
+ char neg, base, state, err;
+};
+
+int __intparse(struct intparse *, const void *, size_t);