File tree Expand file tree Collapse file tree 3 files changed +18
-15
lines changed
Expand file tree Collapse file tree 3 files changed +18
-15
lines changed Original file line number Diff line number Diff line change 2323#include <stdlib.h>
2424#include <string.h>
2525
26+ // About X macro: https://en.wikipedia.org/wiki/X_macro
27+ #define X (name , lenstr , str ) \
28+ _Static_assert(lenstr[0] == strlen(str), "Macro length mismatch for " # name);
29+ #include "defaultatoms.def"
30+ #undef X
31+
2632void defaultatoms_init (GlobalContext * glb )
2733{
2834
29- // About X macro: https://en.wikipedia.org/wiki/X_macro
3035#define X (name , lenstr , str ) \
3136 lenstr str,
3237
@@ -39,10 +44,6 @@ void defaultatoms_init(GlobalContext *glb)
3944#undef X
4045
4146 for (int i = 0 ; i < PLATFORM_ATOMS_BASE_INDEX ; i ++ ) {
42- if (UNLIKELY ((size_t ) atoms [i ][0 ] != strlen (atoms [i ] + 1 ))) {
43- AVM_ABORT ();
44- }
45-
4647 if (UNLIKELY (globalcontext_insert_atom (glb , atoms [i ]) != i )) {
4748 AVM_ABORT ();
4849 }
Original file line number Diff line number Diff line change 2323#include <stdlib.h>
2424#include <string.h>
2525
26+ // About X macro: https://en.wikipedia.org/wiki/X_macro
27+ #define X (name , lenstr , str ) \
28+ _Static_assert(lenstr[0] == strlen(str), "Macro length mismatch for " # name);
29+ #include "platform_defaultatoms.def"
30+ #undef X
31+
2632void platform_defaultatoms_init (GlobalContext * glb )
2733{
28- // About X macro: https://en.wikipedia.org/wiki/X_macro
2934#define X (name , lenstr , str ) \
3035 lenstr str,
3136
@@ -38,10 +43,6 @@ void platform_defaultatoms_init(GlobalContext *glb)
3843#undef X
3944
4045 for (int i = 0 ; i < ATOM_FIRST_AVAIL_INDEX - PLATFORM_ATOMS_BASE_INDEX ; i ++ ) {
41- if (UNLIKELY ((size_t ) atoms [i ][0 ] != strlen (atoms [i ] + 1 ))) {
42- AVM_ABORT ();
43- }
44-
4546 if (UNLIKELY (globalcontext_insert_atom (glb , atoms [i ]) != i + PLATFORM_ATOMS_BASE_INDEX )) {
4647 AVM_ABORT ();
4748 }
Original file line number Diff line number Diff line change 2323#include <stdlib.h>
2424#include <string.h>
2525
26+ // About X macro: https://en.wikipedia.org/wiki/X_macro
27+ #define X (name , lenstr , str ) \
28+ _Static_assert(lenstr[0] == strlen(str), "Macro length mismatch for " # name);
29+ #include "platform_defaultatoms.def"
30+ #undef X
31+
2632void platform_defaultatoms_init (GlobalContext * glb )
2733{
28- // About X macro: https://en.wikipedia.org/wiki/X_macro
2934#define X (name , lenstr , str ) \
3035 lenstr str,
3136
@@ -38,10 +43,6 @@ void platform_defaultatoms_init(GlobalContext *glb)
3843#undef X
3944
4045 for (int i = 0 ; i < ATOM_FIRST_AVAIL_INDEX - PLATFORM_ATOMS_BASE_INDEX ; i ++ ) {
41- if (UNLIKELY ((size_t ) atoms [i ][0 ] != strlen (atoms [i ] + 1 ))) {
42- AVM_ABORT ();
43- }
44-
4546 if (UNLIKELY (globalcontext_insert_atom (glb , atoms [i ]) != i + PLATFORM_ATOMS_BASE_INDEX )) {
4647 AVM_ABORT ();
4748 }
You can’t perform that action at this time.
0 commit comments