diff options
author | Tavian Barnes <tavianator@gmail.com> | 2009-10-29 13:47:07 -0400 |
---|---|---|
committer | Tavian Barnes <tavianator@gmail.com> | 2009-10-29 13:47:07 -0400 |
commit | 51a7516176026a9ce98b07b0c98f71298a5976c2 (patch) | |
tree | e7be3958f46f6a292649b063e3e0782af7000ea3 /dimension | |
parent | af2e515209a1778878b3c81999f45bc8f5889185 (diff) | |
download | dimension-51a7516176026a9ce98b07b0c98f71298a5976c2.tar.xz |
Correct locale "transaction" handling in dmnsn_tokenize().
Diffstat (limited to 'dimension')
-rw-r--r-- | dimension/tokenize.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/dimension/tokenize.c b/dimension/tokenize.c index 508d6d7..03a6a6f 100644 --- a/dimension/tokenize.c +++ b/dimension/tokenize.c @@ -388,14 +388,6 @@ dmnsn_tokenize_directive(const char *filename, dmnsn_array * dmnsn_tokenize(const char *filename, FILE *file) { - /* Save the current locale */ - char *lc_ctype = strdup(setlocale(LC_CTYPE, NULL)); - char *lc_numeric = strdup(setlocale(LC_NUMERIC, NULL)); - - /* Set the locale to `C' to make isalpha(), strtoul(), etc. consistent */ - setlocale(LC_CTYPE, "C"); - setlocale(LC_NUMERIC, "C"); - if (fseeko(file, 0, SEEK_END) != 0) { fprintf(stderr, "Couldn't seek on input stream\n"); return NULL; @@ -416,6 +408,14 @@ dmnsn_tokenize(const char *filename, FILE *file) return NULL; } + /* Save the current locale */ + char *lc_ctype = strdup(setlocale(LC_CTYPE, NULL)); + char *lc_numeric = strdup(setlocale(LC_NUMERIC, NULL)); + + /* Set the locale to `C' to make isalpha(), strtoul(), etc. consistent */ + setlocale(LC_CTYPE, "C"); + setlocale(LC_NUMERIC, "C"); + dmnsn_token token; dmnsn_array *tokens = dmnsn_new_array(sizeof(dmnsn_token)); |