Skip to content

Commit

Permalink
make multiple inclusion protection macrs have _TOYWASM prefix
Browse files Browse the repository at this point in the history
to avoid conflicts with unrelated definitions.
  • Loading branch information
yamt committed Nov 22, 2023
1 parent 950722c commit 7637adc
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 27 deletions.
6 changes: 3 additions & 3 deletions lib/bitmap.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#if !defined(_BITMAP_H)
#define _BITMAP_H
#if !defined(_TOYWASM_BITMAP_H)
#define _TOYWASM_BITMAP_H

#include <stdbool.h>
#include <stdint.h>
Expand All @@ -13,4 +13,4 @@ void bitmap_free(struct bitmap *b);
void bitmap_set(struct bitmap *b, uint32_t idx);
bool bitmap_test(const struct bitmap *b, uint32_t idx);

#endif /* !defined(_BITMAP_H) */
#endif /* !defined(_TOYWASM_BITMAP_H) */
6 changes: 3 additions & 3 deletions lib/cell.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#if !defined(_CELL_H)
#define _CELL_H
#if !defined(_TOYWASM_CELL_H)
#define _TOYWASM_CELL_H

#include <stdint.h>

Expand Down Expand Up @@ -52,4 +52,4 @@ void cells_zero(struct cell *cells, uint32_t ncells);
void cells_copy(struct cell *dst, const struct cell *src, uint32_t ncells);
void cells_move(struct cell *dst, const struct cell *src, uint32_t ncells);

#endif /* !defined(_CELL_H) */
#endif /* !defined(_TOYWASM_CELL_H) */
6 changes: 3 additions & 3 deletions lib/endian.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#if !defined(_ENDIAN_H)
#define _ENDIAN_H
#if !defined(_TOYWASM_ENDIAN_H)
#define _TOYWASM_ENDIAN_H
#include <stdint.h>

uint8_t le8_to_host(uint8_t v);
Expand Down Expand Up @@ -67,4 +67,4 @@ lef64_decode(const void *p)
double lef64_decode(const void *p);
#endif

#endif /* !defined(_ENDIAN_H) */
#endif /* !defined(_TOYWASM_ENDIAN_H) */
6 changes: 3 additions & 3 deletions lib/lock.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#if !defined(_LOCK_H)
#define _LOCK_H
#if !defined(_TOYWASM_LOCK_H)
#define _TOYWASM_LOCK_H

#include "toywasm_config.h"

Expand Down Expand Up @@ -73,4 +73,4 @@ void toywasm_cv_broadcast(pthread_cond_t *cv, struct toywasm_mutex *lock)
#define toywasm_cv_signal(a, lk)
#define toywasm_cv_broadcast(a, lk)
#endif /* defined(USE_PTHREAD) */
#endif /* !defined(_LOCK_H) */
#endif /* !defined(_TOYWASM_LOCK_H) */
6 changes: 3 additions & 3 deletions lib/options.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#if !defined(_OPTIONS_H)
#define _OPTIONS_H
#if !defined(_TOYWASM_OPTIONS_H)
#define _TOYWASM_OPTIONS_H

#include <stdbool.h>
#include <stdint.h>
Expand All @@ -20,4 +20,4 @@ struct exec_options {

void load_options_set_defaults(struct load_options *opts);
void exec_options_set_defaults(struct exec_options *opts);
#endif /* !defined(_OPTIONS_H) */
#endif /* !defined(_TOYWASM_OPTIONS_H) */
6 changes: 3 additions & 3 deletions lib/report.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#if !defined(_REPORT_H)
#define _REPORT_H
#if !defined(_TOYWASM_REPORT_H)
#define _TOYWASM_REPORT_H

#include <stdarg.h>

Expand All @@ -12,4 +12,4 @@ void report_error(struct report *r, const char *fmt, ...)
__attribute__((__format__(__printf__, 2, 3)));
void report_init(struct report *r);
void report_clear(struct report *r);
#endif /* defined(_REPORT_H) */
#endif /* defined(_TOYWASM_REPORT_H) */
6 changes: 3 additions & 3 deletions lib/type.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#if !defined(_TYPE_H)
#define _TYPE_H
#if !defined(_TOYWASM_TYPE_H)
#define _TOYWASM_TYPE_H

#include <stdbool.h>
#include <stdint.h>
Expand Down Expand Up @@ -572,4 +572,4 @@ void clear_resulttype(struct resulttype *rt);
void set_name_cstr(struct name *name, char *cstr);
void clear_name(struct name *name);

#endif /* defined(_TYPE_H) */
#endif /* defined(_TOYWASM_TYPE_H) */
6 changes: 3 additions & 3 deletions lib/valtype.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#if !defined(_VALTYPE_H)
#define _VALTYPE_H
#if !defined(_TOYWASM_VALTYPE_H)
#define _TOYWASM_VALTYPE_H

enum valtype {
/* numtype */
Expand All @@ -20,4 +20,4 @@ enum valtype {
TYPE_UNKNOWN = 0xff,
};

#endif /* !defined(_VALTYPE_H) */
#endif /* !defined(_TOYWASM_VALTYPE_H) */
6 changes: 3 additions & 3 deletions lib/vec.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#if !defined(_VEC_H)
#define _VEC_H
#if !defined(_TOYWASM_VEC_H)
#define _TOYWASM_VEC_H

#include <stdint.h>

Expand Down Expand Up @@ -42,4 +42,4 @@ void _vec_free(void *vec);
#define VEC_POP(v) (&v.p[--v.lsize])
#define VEC_POP_DROP(v) v.lsize--

#endif /* !defined(_VEC_H) */
#endif /* !defined(_TOYWASM_VEC_H) */

0 comments on commit 7637adc

Please sign in to comment.