Fix #3 (Empty containers & IN_STR operator).
This commit is contained in:
1 parent
6464acff57
commit
e21b45d9ac
6 files changed
+15
-3
No files matched your search
@@ -596,12 +596,15 @@
|
||||
M_C3(array_, name,_clean)(array); \
|
||||
char c = fgetc(file); \
|
||||
if (c != '[') return false; \
|
||||
c = fgetc(file); \
|
||||
if (c == ']') return true; \
|
||||
ungetc(c, file); \
|
||||
type item; \
|
||||
M_GET_INIT oplist (item); \
|
||||
do { \
|
||||
bool b = M_GET_IN_STR oplist (item, file); \
|
||||
c = fgetc(file); \
|
||||
if (!b) { /* How to push back char in stream ? */ break; } \
|
||||
if (!b) { break; } \
|
||||
M_C3(array_, name, _push_back)(array, item); \
|
||||
} while (c == M_GET_SEPARATOR oplist && !feof(file) && !ferror(file)); \
|
||||
M_GET_CLEAR oplist (item); \
|
||||
|
||||
+1
-1
@@ -429,7 +429,7 @@ bitset_in_str(bitset_t set, FILE *file)
|
||||
if (c != '[') return false;
|
||||
c = fgetc(file);
|
||||
do {
|
||||
if (c != '0' && c != '1') return false;
|
||||
if (c != '0' && c != '1') break;
|
||||
bool b = (c == '1');
|
||||
bitset_push_back (set, b);
|
||||
c = fgetc(file);
|
||||
|
||||
@@ -403,6 +403,9 @@
|
||||
M_C3(dict_, name, _clean)(dict); \
|
||||
char c = fgetc(file); \
|
||||
if (c != '{') return false; \
|
||||
c = fgetc(file); \
|
||||
if (c == '}') return true; \
|
||||
ungetc(c, file); \
|
||||
key_type key; \
|
||||
value_type value; \
|
||||
M_GET_INIT key_oplist (key); \
|
||||
|
||||
@@ -511,6 +511,9 @@
|
||||
M_C3(list_, name,_clean)(list); \
|
||||
char c = fgetc(file); \
|
||||
if (c != '[') return false; \
|
||||
c = fgetc(file); \
|
||||
if (c == ']') return true; \
|
||||
ungetc(c, file); \
|
||||
type item; \
|
||||
M_GET_INIT oplist (item); \
|
||||
do { \
|
||||
|
||||
@@ -852,6 +852,9 @@ typedef enum {
|
||||
M_C3(rbtree_, name,_clean)(rbtree); \
|
||||
char c = fgetc(file); \
|
||||
if (c != '[') return false; \
|
||||
c = fgetc(file); \
|
||||
if (c == ']') return true; \
|
||||
ungetc(c, file); \
|
||||
type item; \
|
||||
M_GET_INIT oplist (item); \
|
||||
do { \
|
||||
|
||||
+1
-1
@@ -163,7 +163,7 @@ static void test_mpz(void)
|
||||
f = fopen ("a.dat", "rt");
|
||||
if (!f) abort();
|
||||
bool b = array_mpz_in_str (array2, f);
|
||||
//assert (b == true); // The test fail. How to fix?
|
||||
assert (b == true); // The test fail. How to fix?
|
||||
assert (array_mpz_equal_p (array1, array2));
|
||||
fclose(f);
|
||||
|
||||
|
||||
Reference in new issue
Block a user