Skip to content

Commit be3bfe0

Browse files
committed
Refactor of macros
1 parent d5382d5 commit be3bfe0

2 files changed

Lines changed: 10 additions & 14 deletions

File tree

src/libltfs/uthash.h

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -46,17 +46,11 @@
4646
#ifndef LTFS_UTHASH_H
4747
#define LTFS_UTHASH_H
4848

49-
50-
#ifndef HASH_NONFATAL_OOM
51-
#define HASH_NONFATAL_OOM 1
52-
#endif
53-
54-
/* Include official uthash.h from submodule */
55-
#include "uthash_submodule/src/uthash.h"
56-
/* The modifications for LTFS */
49+
/* The modifications for LTFS first */
5750
#include "uthash_ext.h"
51+
/* Include official uthash.h from submodule */
52+
#include "uthash_submodule/src/uthash.h"
5853

5954

6055
#endif /* LTFS_UTHASH_H */
6156

62-
// Made with Bob

src/libltfs/uthash_ext.h

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,17 @@
4646
#ifndef __uthash_ext_h
4747
#define __uthash_ext_h
4848

49-
5049
#ifdef __cplusplus
5150
extern "C" {
5251
#endif
5352

53+
/* Define OOM handling macros before including uthash */
54+
#undef HASH_NONFATAL_OOM
55+
#define HASH_NONFATAL_OOM 1
56+
57+
#undef uthash_nonfatal_oom
58+
#define uthash_nonfatal_oom() do { errno=ENOMEM; } while (0)
59+
5460
#define HASH_FIND_PARTIAL(structure,start,length,table,search,result) \
5561
do { \
5662
structure *s, *tmp; \
@@ -63,10 +69,6 @@ do { \
6369
} \
6470
} while (0)
6571

66-
67-
#undef HASH_RECORD_OOM
68-
#define HASH_RECORD_OOM(oomed) do { (oomed) = 1; errno=ENOMEM; } while (0)
69-
7072
#ifdef __cplusplus
7173
}
7274
#endif

0 commit comments

Comments
 (0)