diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2014-01-08 14:51:22 +0800 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2014-01-09 09:30:25 +0800 |
commit | 1c72b8b0545e6a13ea3db917a1434152c73a3c3b (patch) | |
tree | 64fc4f0195165e1352e980a805fcdf7081e4ba17 /dive.h | |
parent | b9d7e440fd37a4da8455d80a71911a4fbcdbfa11 (diff) | |
download | subsurface-1c72b8b0545e6a13ea3db917a1434152c73a3c3b.tar.gz |
const'ify our strtod() helper functions
The C library doesn't use const char pointers for legacy reasons (and
because you *can* modify the string the end pointer points to), but
let's do it in our internal implementation just because it's a nice
guarantee to have.
We actually used to have a non-const end pointer and replace a decimal
comma with a decimal dot, but that was because we didn't have the fancy
"allow commas" flags. So by using our own strtod_flags() function, we
can now keep all the strings we parse read-only rather than modify them
as we parse them.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'dive.h')
-rw-r--r-- | dive.h | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -789,7 +789,7 @@ extern void remove_weightsystem(struct dive *dive, int idx); #define STRTOD_NO_DOT 0x02 #define STRTOD_NO_COMMA 0x04 #define STRTOD_NO_EXPONENT 0x08 -extern double strtod_flags(char *str, char **ptr, unsigned int flags); +extern double strtod_flags(const char *str, const char **ptr, unsigned int flags); #define STRTOD_ASCII (STRTOD_NO_COMMA) |