diff --git a/m-array.h b/m-array.h index 16481099..45346714 100644 --- a/m-array.h +++ b/m-array.h @@ -677,9 +677,10 @@ assert (file != NULL); \ M_C(name,_clean)(array); \ int c = fgetc(file); \ - if (c != '[') return false; \ + if (M_UNLIKELY (c != '[')) return false; \ c = fgetc(file); \ - if (c == ']') return true; \ + if (M_UNLIKELY (c == ']')) return true; \ + if (M_UNLIKELY (c == EOF)) return false; \ ungetc(c, file); \ type item; \ M_GET_INIT oplist (item); \ diff --git a/m-deque.h b/m-deque.h index 8fb6c597..abb4ff3e 100644 --- a/m-deque.h +++ b/m-deque.h @@ -687,9 +687,10 @@ assert (file != NULL); \ M_C(name,_clean)(deque); \ int c = fgetc(file); \ - if (c != '[') return false; \ + if (M_UNLIKELY (c != '[')) return false; \ c = fgetc(file); \ - if (c == ']') return true; \ + if (M_UNLIKELY (c == ']')) return true; \ + if (M_UNLIKELY (c == EOF)) return false; \ ungetc(c, file); \ type item; \ M_GET_INIT oplist (item); \ diff --git a/m-dict.h b/m-dict.h index bf117b1d..48713366 100644 --- a/m-dict.h +++ b/m-dict.h @@ -504,9 +504,10 @@ DICTI_CONTRACT(name, dict); \ M_C(name, _clean)(dict); \ int c = fgetc(file); \ - if (c != '{') return false; \ + if (M_UNLIKELY (c != '{')) return false; \ c = fgetc(file); \ - if (c == '}') return true; \ + if (M_UNLIKELY (c == '}')) return true; \ + if (M_UNLIKELY (c == EOF)) return true; \ ungetc(c, file); \ key_type key; \ M_IF(isSet)( ,value_type value); \ diff --git a/m-list.h b/m-list.h index 2ec36b06..f71a22d0 100644 --- a/m-list.h +++ b/m-list.h @@ -525,9 +525,10 @@ assert (file != NULL && list != NULL); \ M_C(name,_clean)(list); \ int c = fgetc(file); \ - if (c != '[') return false; \ + if (M_UNLIKELY (c != '[')) return false; \ c = fgetc(file); \ - if (c == ']') return true; \ + if (M_UNLIKELY (c == ']')) return true; \ + if (M_UNLIKELY (c == EOF)) return false; \ ungetc(c, file); \ type item; \ M_GET_INIT oplist (item); \ diff --git a/m-rbtree.h b/m-rbtree.h index 4f363b9b..a9b26c5f 100644 --- a/m-rbtree.h +++ b/m-rbtree.h @@ -948,9 +948,10 @@ typedef enum { assert (file != NULL); \ M_C(name,_clean)(rbtree); \ int c = fgetc(file); \ - if (c != '[') return false; \ + if (M_UNLIKELY (c != '[')) return false; \ c = fgetc(file); \ - if (c == ']') return true; \ + if (M_UNLIKELY (c == ']')) return true; \ + if (M_UNLIKELY (c == EOF)) return false; \ ungetc(c, file); \ type item; \ M_GET_INIT oplist (item); \