iodine 0.7.1 → 0.7.2

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of iodine might be problematic. Click here for more details.

@@ -64,11 +64,10 @@ static void fio_cli_map_line2alias(char const *line) {
64
64
  }
65
65
  const char **old = fio_hash_find(&fio_aliases, FIO_CLI_HASH_VAL(n), n);
66
66
  if (old) {
67
- fprintf(stderr,
68
- "WARNING: CLI argument name conflict detected\n"
69
- " The following two directives conflict:\n"
70
- "\t%s\n\t%s\n",
71
- *old, line);
67
+ FIO_LOG_WARNING("CLI argument name conflict detected\n"
68
+ " The following two directives conflict:\n"
69
+ "\t%s\n\t%s\n",
70
+ *old, line);
72
71
  }
73
72
  fio_hash_insert(&fio_aliases, FIO_CLI_HASH_VAL(n), n, (void *)line);
74
73
  while (n.data[n.len] && (n.data[n.len] == ' ' || n.data[n.len] == ',')) {
@@ -3,10 +3,9 @@ Copyright: Boaz Segev, 2017-2018
3
3
  License: MIT
4
4
  */
5
5
 
6
- #include <fiobject.h>
7
-
8
6
  #define FIO_OVERRIDE_MALLOC 1
9
- #include <fiobj_mem.h>
7
+ #include <fio.h>
8
+ #include <fiobject.h>
10
9
 
11
10
  #define FIO_ARY_TYPE FIOBJ
12
11
  #define FIO_ARY_TYPE_INVALID FIOBJ_INVALID
@@ -30,7 +30,7 @@ License: MIT
30
30
  #include <unistd.h>
31
31
 
32
32
  #define FIO_OVERRIDE_MALLOC 1
33
- #include <fiobj_mem.h>
33
+ #include <fio.h>
34
34
 
35
35
  /* *****************************************************************************
36
36
  Numbers Type
@@ -5,40 +5,33 @@ License: MIT
5
5
 
6
6
  #include <fiobject.h>
7
7
 
8
- #define FIO_OVERRIDE_MALLOC 1
9
- #include <fiobj_mem.h>
10
-
11
- #if !FIO_FORCE_MALLOC
12
- #define FIO_HASH_REALLOC(ptr, original_size, size, valid_data_length) \
13
- fio_realloc2((ptr), (size), (valid_data_length))
14
- #endif
15
-
16
- #include <fiobj_hash.h>
17
-
18
8
  #include <assert.h>
9
+ #include <fiobj_hash.h>
10
+ #define FIO_SET_CALLOC(size, count) fio_calloc((size), (count))
11
+ #define FIO_SET_REALLOC(ptr, original_size, size, valid_data_length) \
12
+ fio_realloc2((ptr), (size), (valid_data_length))
13
+ #define FIO_SET_FREE(ptr, size) fio_free((ptr))
14
+ #define FIO_SET_NAME fio_hash
15
+ #define FIO_SET_KEY_TYPE FIOBJ
16
+ #define FIO_SET_KEY_COMPARE(o1, o2) \
17
+ ((o2) == ((FIOBJ)-1) || (o1) == ((FIOBJ)-1) || fiobj_iseq((o1), (o2)))
18
+ #define FIO_SET_KEY_COPY(dest, obj) ((dest) = fiobj_dup((obj)))
19
+ #define FIO_SET_KEY_DESTROY(obj) \
20
+ do { \
21
+ fiobj_free((obj)); \
22
+ (obj) = FIOBJ_INVALID; \
23
+ } while (0)
24
+ #define FIO_SET_OBJ_TYPE FIOBJ
25
+ #define FIO_SET_OBJ_COMPARE(o1, o2) fiobj_iseq((o1), (o2))
26
+ #define FIO_SET_OBJ_COPY(dest, obj) ((dest) = (obj)) /* take ownership */
27
+ #define FIO_SET_OBJ_DESTROY(obj) \
28
+ do { \
29
+ fiobj_free((obj)); \
30
+ (obj) = FIOBJ_INVALID; \
31
+ } while (0)
19
32
 
20
- typedef struct {
21
- uint64_t hash;
22
- FIOBJ key;
23
- } hash_key_s;
24
-
25
- static hash_key_s hash_key_copy(hash_key_s key) {
26
- fiobj_dup(key.key);
27
- fiobj_str_freeze(key.key);
28
- return key;
29
- }
30
- static void hash_key_free(hash_key_s key) { fiobj_free(key.key); }
31
-
32
- #define FIO_HASH_KEY_TYPE hash_key_s
33
- #define FIO_HASH_KEY_INVALID ((hash_key_s){.hash = 0})
34
- #define FIO_HASH_KEY2UINT(k) ((k).hash)
35
- #define FIO_HASH_COMPARE_KEYS(k1, k2) \
36
- (!(k2).key || fiobj_iseq((k1).key, (k2).key))
37
- #define FIO_HASH_KEY_ISINVALID(k) ((k).hash == 0 && (k).key == 0)
38
- #define FIO_HASH_KEY_COPY(k) hash_key_copy(k)
39
- #define FIO_HASH_KEY_DESTROY(k) hash_key_free(k)
40
-
41
- #include <fio_hashmap.h>
33
+ #define FIO_OVERRIDE_MALLOC 1
34
+ #include <fio.h>
42
35
 
43
36
  #include <errno.h>
44
37
 
@@ -63,13 +56,21 @@ Hash alloc + VTable
63
56
 
64
57
  static void fiobj_hash_dealloc(FIOBJ o, void (*task)(FIOBJ, void *),
65
58
  void *arg) {
66
- FIO_HASH_FOR_FREE(&obj2hash(o)->hash, i) { task((FIOBJ)i->obj, arg); }
59
+ FIO_SET_FOR_LOOP(&obj2hash(o)->hash, i) {
60
+ if (i->obj.key)
61
+ task((FIOBJ)i->obj.obj, arg);
62
+ fiobj_free((FIOBJ)i->obj.key);
63
+ i->obj.key = FIOBJ_INVALID;
64
+ i->obj.obj = FIOBJ_INVALID;
65
+ }
66
+ obj2hash(o)->hash.count = 0;
67
+ fio_hash_free(&obj2hash(o)->hash);
67
68
  free(FIOBJ2PTR(o));
68
69
  }
69
70
 
70
71
  static __thread FIOBJ each_at_key = FIOBJ_INVALID;
71
72
 
72
- static size_t fiobj_hash_each1(FIOBJ o, const size_t start_at,
73
+ static size_t fiobj_hash_each1(FIOBJ o, size_t start_at,
73
74
  int (*task)(FIOBJ obj, void *arg), void *arg) {
74
75
  assert(o && FIOBJ_TYPE_IS(o, FIOBJ_T_HASH));
75
76
  FIOBJ old_each_at_key = each_at_key;
@@ -78,32 +79,28 @@ static size_t fiobj_hash_each1(FIOBJ o, const size_t start_at,
78
79
  if (hash->count == hash->pos) {
79
80
  /* no holes in the hash, we can work as we please. */
80
81
  for (count = start_at; count < hash->count; ++count) {
81
- each_at_key = hash->ordered[count].key.key;
82
- // fprintf(stderr, "each_at_key: %p, hash %p, org %p, obj %p\n",
83
- // (void *)each_at_key, (void *)hash->ordered[count].key.hash,
84
- // (void *)hash->ordered[count].key.key,
85
- // (void *)hash->ordered[count].obj);
86
- if (task((FIOBJ)hash->ordered[count].obj, arg) == -1) {
82
+ each_at_key = hash->ordered[count].obj.key;
83
+ if (task((FIOBJ)hash->ordered[count].obj.obj, arg) == -1) {
87
84
  ++count;
88
85
  goto end;
89
86
  }
90
87
  }
91
88
  } else {
92
- fio_hash_data_ordered_s *i;
93
- const fio_hash_data_ordered_s *stop = hash->ordered + hash->pos;
94
- for (i = hash->ordered; count < start_at && i && i < stop; ++i) {
89
+ size_t pos = 0;
90
+ for (; pos < start_at && pos < hash->pos; ++pos) {
95
91
  /* counting */
96
- if (!i->obj)
97
- continue;
98
- ++count;
92
+ if (hash->ordered[pos].obj.key == FIOBJ_INVALID)
93
+ ++start_at;
94
+ else
95
+ ++count;
99
96
  }
100
- for (; i && i < stop; ++i) {
97
+ for (; pos < hash->pos; ++pos) {
101
98
  /* performing */
102
- if (!i->obj)
99
+ if (hash->ordered[pos].obj.key == FIOBJ_INVALID)
103
100
  continue;
104
101
  ++count;
105
- each_at_key = i->key.key;
106
- if (task((FIOBJ)i->obj, arg) == -1)
102
+ each_at_key = hash->ordered[pos].obj.key;
103
+ if (task((FIOBJ)hash->ordered[pos].obj.obj, arg) == -1)
107
104
  break;
108
105
  }
109
106
  }
@@ -161,12 +158,9 @@ Hash API
161
158
  */
162
159
  FIOBJ fiobj_hash_new(void) {
163
160
  fiobj_hash_s *h = malloc(sizeof(*h));
164
- if (!h) {
165
- perror("ERROR: fiobj hash couldn't allocate memory");
166
- exit(errno);
167
- }
168
- *h = (fiobj_hash_s){.head = {.ref = 1, .type = FIOBJ_T_HASH}};
169
- fio_hash_new(&h->hash);
161
+ FIO_ASSERT_ALLOC(h);
162
+ *h = (fiobj_hash_s){.head = {.ref = 1, .type = FIOBJ_T_HASH},
163
+ .hash = FIO_SET_INIT};
170
164
  return (FIOBJ)h | FIOBJECT_HASH_FLAG;
171
165
  }
172
166
 
@@ -179,12 +173,10 @@ FIOBJ fiobj_hash_new(void) {
179
173
  */
180
174
  FIOBJ fiobj_hash_new2(size_t capa) {
181
175
  fiobj_hash_s *h = malloc(sizeof(*h));
182
- if (!h) {
183
- perror("ERROR: fiobj hash couldn't allocate memory");
184
- exit(errno);
185
- }
186
- *h = (fiobj_hash_s){.head = {.ref = 1, .type = FIOBJ_T_HASH}};
187
- fio_hash_new2(&h->hash, capa);
176
+ FIO_ASSERT_ALLOC(h);
177
+ *h = (fiobj_hash_s){.head = {.ref = 1, .type = FIOBJ_T_HASH},
178
+ .hash = FIO_SET_INIT};
179
+ fio_hash_capa_require(&h->hash, capa);
188
180
  return (FIOBJ)h | FIOBJECT_HASH_FLAG;
189
181
  }
190
182
 
@@ -205,9 +197,9 @@ size_t fiobj_hash_capa(const FIOBJ hash) {
205
197
  */
206
198
  int fiobj_hash_set(FIOBJ hash, FIOBJ key, FIOBJ obj) {
207
199
  assert(hash && FIOBJ_TYPE_IS(hash, FIOBJ_T_HASH));
208
- hash_key_s k = {.hash = fiobj_obj2hash(key), .key = key};
209
- FIOBJ old = (FIOBJ)fio_hash_insert(&obj2hash(hash)->hash, k, (void *)obj);
210
- fiobj_free(old);
200
+ if (FIOBJ_TYPE_IS(key, FIOBJ_T_STRING))
201
+ fiobj_str_freeze(key);
202
+ fio_hash_insert(&obj2hash(hash)->hash, fiobj_obj2hash(key), key, obj);
211
203
  return 0;
212
204
  }
213
205
 
@@ -223,14 +215,13 @@ int fiobj_hash_set(FIOBJ hash, FIOBJ key, FIOBJ obj) {
223
215
  */
224
216
  FIOBJ fiobj_hash_pop(FIOBJ hash, FIOBJ *key) {
225
217
  assert(hash && FIOBJ_TYPE_IS(hash, FIOBJ_T_HASH));
226
- hash_key_s k = {.hash = 0, .key = FIOBJ_INVALID};
227
- FIOBJ old = (FIOBJ)fio_hash_pop(&obj2hash(hash)->hash, &k);
228
- if (!old)
218
+ FIOBJ old;
219
+ if (!fio_hash_last(&obj2hash(hash)->hash))
229
220
  return FIOBJ_INVALID;
221
+ old = fiobj_dup(fio_hash_last(&obj2hash(hash)->hash)->obj);
230
222
  if (key)
231
- *key = k.key;
232
- else
233
- fiobj_free(k.key);
223
+ *key = fiobj_dup(fio_hash_last(&obj2hash(hash)->hash)->key);
224
+ fio_hash_pop(&obj2hash(hash)->hash);
234
225
  return old;
235
226
  }
236
227
 
@@ -245,21 +236,19 @@ FIOBJ fiobj_hash_pop(FIOBJ hash, FIOBJ *key) {
245
236
  */
246
237
  FIOBJ fiobj_hash_replace(FIOBJ hash, FIOBJ key, FIOBJ obj) {
247
238
  assert(hash && FIOBJ_TYPE_IS(hash, FIOBJ_T_HASH));
248
- hash_key_s k = {.hash = fiobj_obj2hash(key), .key = key};
249
- FIOBJ old = (FIOBJ)fio_hash_insert(&obj2hash(hash)->hash, k, (void *)obj);
239
+ FIOBJ old = FIOBJ_INVALID;
240
+ fio_hash_insert2(&obj2hash(hash)->hash, fiobj_obj2hash(key), key, obj, &old);
250
241
  return old;
251
242
  }
252
243
 
253
244
  /**
254
- * Removes a key-value pair from the Hash, if it exists, returning the old
255
- * object (instead of freeing it).
245
+ * Removes a key-value pair from the Hash, if it exists.
256
246
  */
257
247
  FIOBJ fiobj_hash_remove(FIOBJ hash, FIOBJ key) {
258
248
  assert(hash && FIOBJ_TYPE_IS(hash, FIOBJ_T_HASH));
259
- assert(hash && FIOBJ_TYPE_IS(hash, FIOBJ_T_HASH));
260
- return (FIOBJ)fio_hash_insert(
261
- &obj2hash(hash)->hash,
262
- (hash_key_s){.hash = fiobj_obj2hash(key), .key = key}, NULL);
249
+ FIOBJ old = FIOBJ_INVALID;
250
+ fio_hash_remove2(&obj2hash(hash)->hash, fiobj_obj2hash(key), key, &old);
251
+ return old;
263
252
  }
264
253
 
265
254
  /**
@@ -268,8 +257,9 @@ FIOBJ fiobj_hash_remove(FIOBJ hash, FIOBJ key) {
268
257
  */
269
258
  FIOBJ fiobj_hash_remove2(FIOBJ hash, uint64_t hash_value) {
270
259
  assert(hash && FIOBJ_TYPE_IS(hash, FIOBJ_T_HASH));
271
- return (FIOBJ)fio_hash_insert(&obj2hash(hash)->hash,
272
- (hash_key_s){.hash = hash_value}, NULL);
260
+ FIOBJ old = FIOBJ_INVALID;
261
+ fio_hash_remove2(&obj2hash(hash)->hash, hash_value, -1, &old);
262
+ return old;
273
263
  }
274
264
 
275
265
  /**
@@ -279,11 +269,7 @@ FIOBJ fiobj_hash_remove2(FIOBJ hash, uint64_t hash_value) {
279
269
  * Returns -1 on type error or if the object never existed.
280
270
  */
281
271
  int fiobj_hash_delete(FIOBJ hash, FIOBJ key) {
282
- FIOBJ old = fiobj_hash_remove(hash, key);
283
- if (!old)
284
- return -1;
285
- fiobj_free(old);
286
- return 0;
272
+ return fiobj_hash_remove(hash, key);
287
273
  }
288
274
 
289
275
  /**
@@ -297,11 +283,7 @@ int fiobj_hash_delete(FIOBJ hash, FIOBJ key) {
297
283
  * Returns -1 on type error or if the object never existed.
298
284
  */
299
285
  int fiobj_hash_delete2(FIOBJ hash, uint64_t key_hash) {
300
- FIOBJ old = fiobj_hash_remove2(hash, key_hash);
301
- if (!old)
302
- return -1;
303
- fiobj_free(old);
304
- return 0;
286
+ return fio_hash_remove(&obj2hash(hash)->hash, key_hash, -1);
305
287
  }
306
288
 
307
289
  /**
@@ -310,9 +292,10 @@ int fiobj_hash_delete2(FIOBJ hash, uint64_t key_hash) {
310
292
  */
311
293
  FIOBJ fiobj_hash_get(const FIOBJ hash, FIOBJ key) {
312
294
  assert(hash && FIOBJ_TYPE_IS(hash, FIOBJ_T_HASH));
313
- return (FIOBJ)fio_hash_find(
314
- &obj2hash(hash)->hash,
315
- (hash_key_s){.hash = fiobj_obj2hash(key), .key = key});
295
+ FIOBJ *old = fio_hash_find(&obj2hash(hash)->hash, fiobj_obj2hash(key), key);
296
+ if (old)
297
+ return *old;
298
+ return FIOBJ_INVALID;
316
299
  }
317
300
 
318
301
  /**
@@ -325,9 +308,10 @@ FIOBJ fiobj_hash_get(const FIOBJ hash, FIOBJ key) {
325
308
  */
326
309
  FIOBJ fiobj_hash_get2(const FIOBJ hash, uint64_t key_hash) {
327
310
  assert(hash && FIOBJ_TYPE_IS(hash, FIOBJ_T_HASH));
328
- return (FIOBJ)fio_hash_find(&obj2hash(hash)->hash, (hash_key_s){
329
- .hash = key_hash,
330
- });
311
+ FIOBJ *old = fio_hash_find(&obj2hash(hash)->hash, key_hash, -1);
312
+ if (old)
313
+ return *old;
314
+ return FIOBJ_INVALID;
331
315
  }
332
316
 
333
317
  /**
@@ -335,8 +319,7 @@ FIOBJ fiobj_hash_get2(const FIOBJ hash, uint64_t key_hash) {
335
319
  */
336
320
  int fiobj_hash_haskey(const FIOBJ hash, FIOBJ key) {
337
321
  assert(hash && FIOBJ_TYPE_IS(hash, FIOBJ_T_HASH));
338
- hash_key_s k = {.hash = fiobj_obj2hash(key), .key = key};
339
- return (FIOBJ)fio_hash_find(&obj2hash(hash)->hash, k) != 0;
322
+ return fio_hash_find(&obj2hash(hash)->hash, fiobj_obj2hash(key), key) != NULL;
340
323
  }
341
324
 
342
325
  /**
@@ -344,7 +327,7 @@ int fiobj_hash_haskey(const FIOBJ hash, FIOBJ key) {
344
327
  */
345
328
  void fiobj_hash_clear(const FIOBJ hash) {
346
329
  assert(hash && FIOBJ_TYPE_IS(hash, FIOBJ_T_HASH));
347
- FIO_HASH_FOR_EMPTY(&obj2hash(hash)->hash, i) { fiobj_free((FIOBJ)i->obj); }
330
+ fio_hash_free(&obj2hash(hash)->hash);
348
331
  }
349
332
 
350
333
  /* *****************************************************************************
@@ -374,16 +357,16 @@ void fiobj_test_hash(void) {
374
357
  TEST_ASSERT(fiobj_hash_get2(o, fiobj_obj2hash(str_key)) == fiobj_true(),
375
358
  "hash compare didn't get value back");
376
359
 
377
- FIOBJ o2 = fiobj_hash_new2(1);
378
- TEST_ASSERT(obj2hash(o2)->hash.capa == 1,
379
- "Hash capacity should be initialized to 1! %zu != 1\n",
360
+ FIOBJ o2 = fiobj_hash_new2(3);
361
+ TEST_ASSERT(obj2hash(o2)->hash.capa >= 3,
362
+ "Hash capacity should be larger than 3! %zu != 4\n",
380
363
  (size_t)obj2hash(o2)->hash.capa);
381
364
  fiobj_hash_set(o2, str_key, fiobj_true());
382
365
  TEST_ASSERT(fiobj_hash_is_eq(o, o2), "Hashes not equal at core! %zu != %zu\n",
383
366
  fiobj_hash_count(o), fiobj_hash_count(o2));
384
367
  TEST_ASSERT(fiobj_iseq(o, o2), "Hashes not equal!\n");
385
- TEST_ASSERT(obj2hash(o2)->hash.capa == 1,
386
- "Hash capacity should be 1! %zu != 1\n",
368
+ TEST_ASSERT(obj2hash(o2)->hash.capa > 3,
369
+ "Hash capacity should be larger than 3! %zu != 4\n",
387
370
  (size_t)obj2hash(o2)->hash.capa);
388
371
 
389
372
  fiobj_hash_delete(o, str_key);
@@ -2,6 +2,7 @@
2
2
  Copyright: Boaz Segev, 2017-2018
3
3
  License: MIT
4
4
  */
5
+ #include <fio.h>
5
6
  #include <fiobj_json.h>
6
7
 
7
8
  #include <fio_ary.h>
@@ -110,8 +111,8 @@ static int fio_json_on_start_object(json_parser_s *p) {
110
111
  static void fio_json_on_end_object(json_parser_s *p) {
111
112
  fiobj_json_parser_s *pr = (fiobj_json_parser_s *)p;
112
113
  if (pr->key) {
113
- fprintf(stderr, "WARNING: (JSON parsing) malformed JSON, "
114
- "ignoring dangling Hash key.\n");
114
+ FIO_LOG_WARNING("(JSON parsing) malformed JSON, "
115
+ "ignoring dangling Hash key.");
115
116
  fiobj_free(pr->key);
116
117
  pr->key = FIOBJ_INVALID;
117
118
  }
@@ -147,7 +148,7 @@ static void fio_json_on_json(json_parser_s *p) {
147
148
  static void fio_json_on_error(json_parser_s *p) {
148
149
  fiobj_json_parser_s *pr = (fiobj_json_parser_s *)p;
149
150
  #if DEBUG
150
- fprintf(stderr, "ERROR: JSON on error called.\n");
151
+ FIO_LOG_DEBUG("JSON on error called.");
151
152
  #endif
152
153
  fiobj_free((FIOBJ)fio_ary_index(&pr->stack, 0));
153
154
  fiobj_free(pr->key);
@@ -7,7 +7,7 @@ License: MIT
7
7
  #include <fiobject.h>
8
8
 
9
9
  #define FIO_OVERRIDE_MALLOC 1
10
- #include <fiobj_mem.h>
10
+ #include <fio.h>
11
11
 
12
12
  #include <assert.h>
13
13
  #include <errno.h>
@@ -30,9 +30,9 @@ License: MIT
30
30
  #include <sys/stat.h>
31
31
 
32
32
  #define FIO_OVERRIDE_MALLOC 1
33
- #include <fiobj_mem.h>
34
-
35
- #include <fio_str.h>
33
+ #define FIO_INCLUDE_STR
34
+ #define FIO_STR_NO_REF
35
+ #include <fio.h>
36
36
 
37
37
  #ifndef PATH_MAX
38
38
  #define PATH_MAX PAGE_SIZE
@@ -51,7 +51,7 @@ typedef struct {
51
51
  #define obj2str(o) ((fiobj_str_s *)(FIOBJ2PTR(o)))
52
52
 
53
53
  static inline fio_str_info_s fiobj_str_get_cstr(const FIOBJ o) {
54
- return fio_str_state(&obj2str(o)->str);
54
+ return fio_str_info(&obj2str(o)->str);
55
55
  }
56
56
 
57
57
  /* *****************************************************************************
@@ -330,7 +330,7 @@ uint64_t fiobj_str_hash(FIOBJ o) {
330
330
  if (obj2str(o)->hash) {
331
331
  return obj2str(o)->hash;
332
332
  }
333
- fio_str_info_s state = fio_str_state(&obj2str(o)->str);
333
+ fio_str_info_s state = fio_str_info(&obj2str(o)->str);
334
334
  obj2str(o)->hash = fio_siphash(state.data, state.len);
335
335
  return obj2str(o)->hash;
336
336
  }
@@ -8,6 +8,8 @@ This facil.io core library provides wrappers around complex and (or) dynamic
8
8
  types, abstracting some complexity and making dynamic type related tasks easier.
9
9
  */
10
10
  #include <fiobject.h>
11
+ #undef FIO_FORCE_MALLOC /* just in case */
12
+ #include <fio.h>
11
13
 
12
14
  #include <fio_ary.h>
13
15
 
@@ -21,7 +23,7 @@ Use the facil.io allocator when available
21
23
  ***************************************************************************** */
22
24
 
23
25
  #pragma weak fio_malloc
24
- void *__attribute__((weak)) fio_malloc(size_t size) {
26
+ void *fio_malloc(size_t size) {
25
27
  void *m = malloc(size);
26
28
  if (m)
27
29
  memset(m, 0, size);
@@ -51,8 +53,17 @@ fio_realloc2(void *ptr, size_t new_size, size_t valid_len) {
51
53
  #pragma weak fio_mmap
52
54
  void *__attribute__((weak)) fio_mmap(size_t size) { return fio_malloc(size); }
53
55
 
56
+ /** The logging level */
57
+ #if DEBUG
58
+ #pragma weak FIO_LOG_LEVEL
59
+ size_t __attribute__((weak)) FIO_LOG_LEVEL = FIO_LOG_LEVEL_DEBUG;
60
+ #else
61
+ #pragma weak FIO_LOG_LEVEL
62
+ size_t __attribute__((weak)) FIO_LOG_LEVEL = FIO_LOG_LEVEL_INFO;
63
+ #endif
64
+
54
65
  #define FIO_OVERRIDE_MALLOC 1
55
- #include <fiobj_mem.h>
66
+ #include <fio.h>
56
67
 
57
68
  /* *****************************************************************************
58
69
  the `fiobj_each2` function
@@ -196,7 +207,7 @@ static inline int fiobj_iseq_simple(const FIOBJ o, const FIOBJ o2) {
196
207
  return 1;
197
208
  }
198
209
 
199
- int fiobj_iseq____internal_complex__task(FIOBJ o, void *ary_) {
210
+ static int fiobj_iseq____internal_complex__task(FIOBJ o, void *ary_) {
200
211
  fio_ary_s *ary = ary_;
201
212
  fio_ary_push(ary, (void *)o);
202
213
  if (fiobj_hash_key_in_loop())