koffi 2.14.0-beta.3 → 2.14.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/CHANGELOG.md +18 -1
  2. package/README.md +1 -1
  3. package/build/koffi/darwin_arm64/koffi.node +0 -0
  4. package/build/koffi/darwin_x64/koffi.node +0 -0
  5. package/build/koffi/freebsd_arm64/koffi.node +0 -0
  6. package/build/koffi/freebsd_ia32/koffi.node +0 -0
  7. package/build/koffi/freebsd_x64/koffi.node +0 -0
  8. package/build/koffi/linux_arm64/koffi.node +0 -0
  9. package/build/koffi/linux_armhf/koffi.node +0 -0
  10. package/build/koffi/linux_ia32/koffi.node +0 -0
  11. package/build/koffi/linux_loong64/koffi.node +0 -0
  12. package/build/koffi/linux_riscv64d/koffi.node +0 -0
  13. package/build/koffi/linux_x64/koffi.node +0 -0
  14. package/build/koffi/musl_arm64/koffi.node +0 -0
  15. package/build/koffi/musl_x64/koffi.node +0 -0
  16. package/build/koffi/openbsd_ia32/koffi.node +0 -0
  17. package/build/koffi/openbsd_x64/koffi.node +0 -0
  18. package/build/koffi/win32_arm64/koffi.node +0 -0
  19. package/build/koffi/win32_ia32/koffi.node +0 -0
  20. package/build/koffi/win32_x64/koffi.node +0 -0
  21. package/doc/pages/index.md +43 -4
  22. package/doc/pages/input.md +66 -0
  23. package/doc/pages/platforms.md +8 -19
  24. package/doc/pages.ini +0 -7
  25. package/doc/static/perf_windows.png +0 -0
  26. package/index.d.ts +0 -1
  27. package/index.js +10 -9
  28. package/indirect.js +10 -9
  29. package/package.json +3 -2
  30. package/src/cnoke/src/builder.js +1 -2
  31. package/src/core/base/base.cc +815 -554
  32. package/src/core/base/base.hh +578 -450
  33. package/src/core/base/crc.inc +1 -1
  34. package/src/core/base/crc_gen.py +1 -1
  35. package/src/core/base/unicode.inc +1 -1
  36. package/src/core/base/unicode_gen.py +1 -1
  37. package/src/koffi/src/abi_arm32.cc +24 -24
  38. package/src/koffi/src/abi_arm64.cc +29 -29
  39. package/src/koffi/src/abi_riscv64.cc +27 -27
  40. package/src/koffi/src/abi_x64_sysv.cc +29 -29
  41. package/src/koffi/src/abi_x64_win.cc +20 -20
  42. package/src/koffi/src/abi_x86.cc +26 -26
  43. package/src/koffi/src/call.cc +83 -237
  44. package/src/koffi/src/call.hh +8 -8
  45. package/src/koffi/src/ffi.cc +71 -67
  46. package/src/koffi/src/ffi.hh +9 -9
  47. package/src/koffi/src/parser.cc +2 -2
  48. package/src/koffi/src/parser.hh +1 -1
  49. package/src/koffi/src/trampolines/prototypes.inc +1 -1
  50. package/src/koffi/src/util.cc +43 -43
  51. package/src/koffi/src/util.hh +5 -5
  52. package/src/koffi/src/win32.cc +5 -5
  53. package/src/koffi/src/win32.hh +1 -1
@@ -26,7 +26,7 @@
26
26
 
27
27
  #include <napi.h>
28
28
 
29
- namespace RG {
29
+ namespace K {
30
30
 
31
31
  // Value does not matter, the tag system uses memory addresses
32
32
  const napi_type_tag TypeInfoMarker = { 0x1cc449675b294374, 0xbb13a50e97dcb017 };
@@ -35,7 +35,7 @@ const napi_type_tag MagicUnionMarker = { 0x5eaf2245526a4c7d, 0x8c86c9ee2b96ffc8
35
35
 
36
36
  Napi::Function MagicUnion::InitClass(Napi::Env env, const TypeInfo *type)
37
37
  {
38
- RG_ASSERT(type->primitive == PrimitiveKind::Union);
38
+ K_ASSERT(type->primitive == PrimitiveKind::Union);
39
39
 
40
40
  // node-addon-api wants std::vector
41
41
  std::vector<Napi::ClassPropertyDescriptor<MagicUnion>> properties;
@@ -96,7 +96,7 @@ Napi::Value MagicUnion::Getter(const Napi::CallbackInfo &info)
96
96
  active_idx = idx;
97
97
  }
98
98
 
99
- RG_ASSERT(!value.IsEmpty());
99
+ K_ASSERT(!value.IsEmpty());
100
100
  return value;
101
101
  }
102
102
 
@@ -203,7 +203,7 @@ const TypeInfo *ResolveType(Napi::Value value, int *out_directions)
203
203
  const TypeInfo *raw = external.Data();
204
204
 
205
205
  const TypeInfo *type = AlignDown(raw, 4);
206
- RG_ASSERT(type);
206
+ K_ASSERT(type);
207
207
 
208
208
  if (out_directions) {
209
209
  Size delta = (uint8_t *)raw - (uint8_t *)type;
@@ -343,7 +343,7 @@ const TypeInfo *ResolveType(Napi::Env env, Span<const char> str)
343
343
 
344
344
  TypeInfo *copy = instance->types.AppendDefault();
345
345
 
346
- memcpy((void *)copy, (const void *)type, RG_SIZE(*type));
346
+ memcpy((void *)copy, (const void *)type, K_SIZE(*type));
347
347
  copy->name = Fmt(&instance->str_alloc, "<anonymous_%1>", instance->types.count).ptr;
348
348
  copy->members.allocator = GetNullAllocator();
349
349
 
@@ -373,12 +373,12 @@ const TypeInfo *ResolveType(Napi::Env env, Span<const char> str)
373
373
  }
374
374
 
375
375
  type = MakeArrayType(instance, type, len);
376
- RG_ASSERT(type);
376
+ K_ASSERT(type);
377
377
  } else {
378
- RG_ASSERT(!len);
378
+ K_ASSERT(!len);
379
379
 
380
380
  type = MakePointerType(instance, type);
381
- RG_ASSERT(type);
381
+ K_ASSERT(type);
382
382
  }
383
383
  }
384
384
 
@@ -392,7 +392,7 @@ const TypeInfo *ResolveType(Napi::Env env, Span<const char> str)
392
392
 
393
393
  TypeInfo *MakePointerType(InstanceData *instance, const TypeInfo *ref, int count)
394
394
  {
395
- RG_ASSERT(count >= 1);
395
+ K_ASSERT(count >= 1);
396
396
 
397
397
  for (int i = 0; i < count; i++) {
398
398
  char name_buf[256];
@@ -408,14 +408,14 @@ TypeInfo *MakePointerType(InstanceData *instance, const TypeInfo *ref, int count
408
408
 
409
409
  if (ref->primitive != PrimitiveKind::Prototype) {
410
410
  type->primitive = PrimitiveKind::Pointer;
411
- type->size = RG_SIZE(void *);
412
- type->align = RG_SIZE(void *);
411
+ type->size = K_SIZE(void *);
412
+ type->align = K_SIZE(void *);
413
413
  type->ref.type = ref;
414
414
  type->hint = (ref->flags & (int)TypeFlag::HasTypedArray) ? ArrayHint::Typed : ArrayHint::Array;
415
415
  } else {
416
416
  type->primitive = PrimitiveKind::Callback;
417
- type->size = RG_SIZE(void *);
418
- type->align = RG_SIZE(void *);
417
+ type->size = K_SIZE(void *);
418
+ type->align = K_SIZE(void *);
419
419
  type->ref.proto = ref->ref.proto;
420
420
  }
421
421
 
@@ -431,8 +431,8 @@ TypeInfo *MakePointerType(InstanceData *instance, const TypeInfo *ref, int count
431
431
 
432
432
  static TypeInfo *MakeArrayType(InstanceData *instance, const TypeInfo *ref, Size len, ArrayHint hint, bool insert)
433
433
  {
434
- RG_ASSERT(len >= 0);
435
- RG_ASSERT(len <= instance->config.max_type_size / ref->size);
434
+ K_ASSERT(len >= 0);
435
+ K_ASSERT(len <= instance->config.max_type_size / ref->size);
436
436
 
437
437
  TypeInfo *type = instance->types.AppendDefault();
438
438
 
@@ -597,7 +597,7 @@ const char *GetValueType(const InstanceData *instance, Napi::Value value)
597
597
 
598
598
  void SetValueTag(const InstanceData *instance, Napi::Value value, const void *marker)
599
599
  {
600
- static_assert(RG_SIZE(TypeInfo) >= 16);
600
+ static_assert(K_SIZE(TypeInfo) >= 16);
601
601
 
602
602
  // We used to make a temporary tag on the stack with lower set to a constant value and
603
603
  // upper to the pointer address, but this broke in Node 20.12 and Node 21.6 due to ExternalWrapper
@@ -611,7 +611,7 @@ void SetValueTag(const InstanceData *instance, Napi::Value value, const void *ma
611
611
  const napi_type_tag *tag = (const napi_type_tag *)marker;
612
612
 
613
613
  napi_status status = napi_type_tag_object(value.Env(), value, tag);
614
- RG_ASSERT(status == napi_ok);
614
+ K_ASSERT(status == napi_ok);
615
615
  }
616
616
 
617
617
  bool CheckValueTag(const InstanceData *instance, Napi::Value value, const void *marker)
@@ -641,7 +641,7 @@ int GetTypedArrayType(const TypeInfo *type)
641
641
  default: return -1;
642
642
  }
643
643
 
644
- RG_UNREACHABLE();
644
+ K_UNREACHABLE();
645
645
  }
646
646
 
647
647
  Napi::String MakeStringFromUTF32(Napi::Env env, const char32_t *ptr, Size len)
@@ -766,10 +766,10 @@ static uint32_t DecodeDynamicLength(const uint8_t *origin, const RecordMember &b
766
766
  case PrimitiveKind::Array:
767
767
  case PrimitiveKind::Float32:
768
768
  case PrimitiveKind::Float64:
769
- case PrimitiveKind::Prototype: { RG_UNREACHABLE(); } break;
769
+ case PrimitiveKind::Prototype: { K_UNREACHABLE(); } break;
770
770
  }
771
771
 
772
- RG_UNREACHABLE();
772
+ K_UNREACHABLE();
773
773
  }
774
774
 
775
775
  void DecodeObject(Napi::Object obj, const uint8_t *origin, const TypeInfo *type)
@@ -777,7 +777,7 @@ void DecodeObject(Napi::Object obj, const uint8_t *origin, const TypeInfo *type)
777
777
  Napi::Env env = obj.Env();
778
778
  InstanceData *instance = env.GetInstanceData<InstanceData>();
779
779
 
780
- RG_ASSERT(type->primitive == PrimitiveKind::Record);
780
+ K_ASSERT(type->primitive == PrimitiveKind::Record);
781
781
 
782
782
  for (Size i = 0; i < type->members.len; i++) {
783
783
  const RecordMember &member = type->members[i];
@@ -785,7 +785,7 @@ void DecodeObject(Napi::Object obj, const uint8_t *origin, const TypeInfo *type)
785
785
  const uint8_t *src = origin + member.offset;
786
786
 
787
787
  switch (member.type->primitive) {
788
- case PrimitiveKind::Void: { RG_UNREACHABLE(); } break;
788
+ case PrimitiveKind::Void: { K_UNREACHABLE(); } break;
789
789
 
790
790
  case PrimitiveKind::Bool: {
791
791
  bool b = *(bool *)src;
@@ -929,7 +929,7 @@ void DecodeObject(Napi::Object obj, const uint8_t *origin, const TypeInfo *type)
929
929
  obj.Set(member.name, Napi::Number::New(env, d));
930
930
  } break;
931
931
 
932
- case PrimitiveKind::Prototype: { RG_UNREACHABLE(); } break;
932
+ case PrimitiveKind::Prototype: { K_UNREACHABLE(); } break;
933
933
  }
934
934
  }
935
935
  }
@@ -964,7 +964,7 @@ Napi::Value DecodeArray(Napi::Env env, const uint8_t *origin, const TypeInfo *ty
964
964
  }); \
965
965
  } else { \
966
966
  Napi::TypedArrayType array = Napi::TypedArrayType::New(env, len); \
967
- Span<uint8_t> buffer = MakeSpan((uint8_t *)array.ArrayBuffer().Data(), (Size)len * RG_SIZE(CType)); \
967
+ Span<uint8_t> buffer = MakeSpan((uint8_t *)array.ArrayBuffer().Data(), (Size)len * K_SIZE(CType)); \
968
968
  \
969
969
  DecodeBuffer(buffer, origin, type->ref.type); \
970
970
  \
@@ -981,7 +981,7 @@ Napi::Value DecodeArray(Napi::Env env, const uint8_t *origin, const TypeInfo *ty
981
981
  }); \
982
982
  } else { \
983
983
  Napi::TypedArrayType array = Napi::TypedArrayType::New(env, len); \
984
- Span<uint8_t> buffer = MakeSpan((uint8_t *)array.ArrayBuffer().Data(), (Size)len * RG_SIZE(CType)); \
984
+ Span<uint8_t> buffer = MakeSpan((uint8_t *)array.ArrayBuffer().Data(), (Size)len * K_SIZE(CType)); \
985
985
  \
986
986
  DecodeBuffer(buffer, origin, type->ref.type); \
987
987
  \
@@ -990,7 +990,7 @@ Napi::Value DecodeArray(Napi::Env env, const uint8_t *origin, const TypeInfo *ty
990
990
  } while (false)
991
991
 
992
992
  switch (type->ref.type->primitive) {
993
- case PrimitiveKind::Void: { RG_UNREACHABLE(); } break;
993
+ case PrimitiveKind::Void: { K_UNREACHABLE(); } break;
994
994
 
995
995
  case PrimitiveKind::Bool: {
996
996
  POP_ARRAY({
@@ -1111,19 +1111,19 @@ Napi::Value DecodeArray(Napi::Env env, const uint8_t *origin, const TypeInfo *ty
1111
1111
  case PrimitiveKind::Float32: { POP_NUMBER_ARRAY(Float32Array, float); } break;
1112
1112
  case PrimitiveKind::Float64: { POP_NUMBER_ARRAY(Float64Array, double); } break;
1113
1113
 
1114
- case PrimitiveKind::Prototype: { RG_UNREACHABLE(); } break;
1114
+ case PrimitiveKind::Prototype: { K_UNREACHABLE(); } break;
1115
1115
  }
1116
1116
 
1117
1117
  #undef POP_NUMBER_ARRAY_SWAP
1118
1118
  #undef POP_NUMBER_ARRAY
1119
1119
  #undef POP_ARRAY
1120
1120
 
1121
- RG_UNREACHABLE();
1121
+ K_UNREACHABLE();
1122
1122
  }
1123
1123
 
1124
1124
  Napi::Value DecodeArray(Napi::Env env, const uint8_t *origin, const TypeInfo *type)
1125
1125
  {
1126
- RG_ASSERT(type->primitive == PrimitiveKind::Array);
1126
+ K_ASSERT(type->primitive == PrimitiveKind::Array);
1127
1127
 
1128
1128
  uint32_t len = type->size / type->ref.type->size;
1129
1129
  return DecodeArray(env, origin, type, len);
@@ -1134,7 +1134,7 @@ void DecodeNormalArray(Napi::Array array, const uint8_t *origin, const TypeInfo
1134
1134
  Napi::Env env = array.Env();
1135
1135
  InstanceData *instance = env.GetInstanceData<InstanceData>();
1136
1136
 
1137
- RG_ASSERT(array.IsArray());
1137
+ K_ASSERT(array.IsArray());
1138
1138
 
1139
1139
  Size offset = 0;
1140
1140
  uint32_t len = array.Length();
@@ -1168,7 +1168,7 @@ void DecodeNormalArray(Napi::Array array, const uint8_t *origin, const TypeInfo
1168
1168
  } while (false)
1169
1169
 
1170
1170
  switch (ref->primitive) {
1171
- case PrimitiveKind::Void: { RG_UNREACHABLE(); } break;
1171
+ case PrimitiveKind::Void: { K_UNREACHABLE(); } break;
1172
1172
 
1173
1173
  case PrimitiveKind::Bool: {
1174
1174
  POP_ARRAY({
@@ -1275,7 +1275,7 @@ void DecodeNormalArray(Napi::Array array, const uint8_t *origin, const TypeInfo
1275
1275
  case PrimitiveKind::Float32: { POP_NUMBER_ARRAY(float); } break;
1276
1276
  case PrimitiveKind::Float64: { POP_NUMBER_ARRAY(double); } break;
1277
1277
 
1278
- case PrimitiveKind::Prototype: { RG_UNREACHABLE(); } break;
1278
+ case PrimitiveKind::Prototype: { K_UNREACHABLE(); } break;
1279
1279
  }
1280
1280
 
1281
1281
  #undef POP_NUMBER_ARRAY_SWAP
@@ -1291,7 +1291,7 @@ void DecodeBuffer(Span<uint8_t> buffer, const uint8_t *origin, const TypeInfo *r
1291
1291
  #define SWAP(CType) \
1292
1292
  do { \
1293
1293
  CType *data = (CType *)buffer.ptr; \
1294
- Size len = buffer.len / RG_SIZE(CType); \
1294
+ Size len = buffer.len / K_SIZE(CType); \
1295
1295
  \
1296
1296
  for (Size i = 0; i < len; i++) { \
1297
1297
  data[i] = ReverseBytes(data[i]); \
@@ -1361,17 +1361,17 @@ Napi::Value Decode(Napi::Env env, const uint8_t *ptr, const TypeInfo *type, cons
1361
1361
  } break;
1362
1362
  case PrimitiveKind::Int16:
1363
1363
  case PrimitiveKind::UInt16: {
1364
- Size count = NullTerminatedLength((const char16_t *)ptr, RG_SIZE_MAX);
1364
+ Size count = NullTerminatedLength((const char16_t *)ptr, K_SIZE_MAX);
1365
1365
  type = MakeArrayType(instance, type, count);
1366
1366
  } break;
1367
1367
  case PrimitiveKind::Int32:
1368
1368
  case PrimitiveKind::UInt32: {
1369
- Size count = NullTerminatedLength((const char32_t *)ptr, RG_SIZE_MAX);
1369
+ Size count = NullTerminatedLength((const char32_t *)ptr, K_SIZE_MAX);
1370
1370
  type = MakeArrayType(instance, type, count);
1371
1371
  } break;
1372
1372
 
1373
1373
  case PrimitiveKind::Pointer: {
1374
- Size count = NullTerminatedLength((const void **)ptr, RG_SIZE_MAX);
1374
+ Size count = NullTerminatedLength((const void **)ptr, K_SIZE_MAX);
1375
1375
  type = MakeArrayType(instance, type, count);
1376
1376
  } break;
1377
1377
 
@@ -1470,14 +1470,14 @@ Napi::Value Decode(Napi::Env env, const uint8_t *ptr, const TypeInfo *type, cons
1470
1470
 
1471
1471
  case PrimitiveKind::Prototype: {
1472
1472
  const FunctionInfo *proto = type->ref.proto;
1473
- RG_ASSERT(!proto->variadic);
1474
- RG_ASSERT(!proto->lib);
1473
+ K_ASSERT(!proto->variadic);
1474
+ K_ASSERT(!proto->lib);
1475
1475
 
1476
1476
  FunctionInfo *func = new FunctionInfo();
1477
- RG_DEFER { func->Unref(); };
1477
+ K_DEFER { func->Unref(); };
1478
1478
 
1479
- memcpy((void *)func, proto, RG_SIZE(*proto));
1480
- memset((void *)&func->parameters, 0, RG_SIZE(func->parameters));
1479
+ memcpy((void *)func, proto, K_SIZE(*proto));
1480
+ memset((void *)&func->parameters, 0, K_SIZE(func->parameters));
1481
1481
  func->parameters = proto->parameters;
1482
1482
 
1483
1483
  func->name = "<anonymous>";
@@ -1575,7 +1575,7 @@ bool Encode(Napi::Env env, uint8_t *origin, Napi::Value value, const TypeInfo *t
1575
1575
  } while (false)
1576
1576
 
1577
1577
  switch (type->primitive) {
1578
- case PrimitiveKind::Void: { RG_UNREACHABLE(); } break;
1578
+ case PrimitiveKind::Void: { K_UNREACHABLE(); } break;
1579
1579
 
1580
1580
  case PrimitiveKind::Bool: {
1581
1581
  if (!value.IsBoolean()) [[unlikely]] {
@@ -1688,7 +1688,7 @@ bool Encode(Napi::Env env, uint8_t *origin, Napi::Value value, const TypeInfo *t
1688
1688
  *(void **)origin = ptr;
1689
1689
  } break;
1690
1690
 
1691
- case PrimitiveKind::Prototype: { RG_UNREACHABLE(); } break;
1691
+ case PrimitiveKind::Prototype: { K_UNREACHABLE(); } break;
1692
1692
  }
1693
1693
 
1694
1694
  #undef PUSH_INTEGER_SWAP
@@ -26,7 +26,7 @@
26
26
 
27
27
  #include <napi.h>
28
28
 
29
- namespace RG {
29
+ namespace K {
30
30
 
31
31
  extern const napi_type_tag TypeInfoMarker;
32
32
  extern const napi_type_tag CastMarker;
@@ -151,7 +151,7 @@ static inline Span<uint8_t> GetRawBuffer(Napi::Value value)
151
151
  return MakeSpan((uint8_t *)buffer.Data(), (Size)buffer.ByteLength());
152
152
  }
153
153
 
154
- RG_UNREACHABLE();
154
+ K_UNREACHABLE();
155
155
  }
156
156
 
157
157
  int GetTypedArrayType(const TypeInfo *type);
@@ -159,7 +159,7 @@ int GetTypedArrayType(const TypeInfo *type);
159
159
  template <typename T>
160
160
  T GetNumber(Napi::Value value)
161
161
  {
162
- RG_ASSERT(value.IsNumber() || value.IsBigInt());
162
+ K_ASSERT(value.IsNumber() || value.IsBigInt());
163
163
 
164
164
  if (value.IsNumber()) [[likely]] {
165
165
  return (T)value.As<Napi::Number>().DoubleValue();
@@ -170,7 +170,7 @@ T GetNumber(Napi::Value value)
170
170
  return (T)bigint.Uint64Value(&lossless);
171
171
  }
172
172
 
173
- RG_UNREACHABLE();
173
+ K_UNREACHABLE();
174
174
  }
175
175
 
176
176
  template <typename T>
@@ -237,7 +237,7 @@ static inline Napi::Array GetOwnPropertyNames(Napi::Object obj)
237
237
  napi_status status = napi_get_all_property_names(env, obj, napi_key_own_only,
238
238
  (napi_key_filter)(napi_key_enumerable | napi_key_skip_symbols),
239
239
  napi_key_numbers_to_strings, &result);
240
- RG_ASSERT(status == napi_ok);
240
+ K_ASSERT(status == napi_ok);
241
241
 
242
242
  return Napi::Array(env, result);
243
243
  }
@@ -34,7 +34,7 @@
34
34
  #include <ntsecapi.h>
35
35
  #include <processthreadsapi.h>
36
36
 
37
- namespace RG {
37
+ namespace K {
38
38
 
39
39
  const HashMap<int, const char *> WindowsMachineNames = {
40
40
  { 0x184, "Alpha AXP, 32-bit" },
@@ -138,9 +138,9 @@ static int GetFileMachine(HANDLE h, bool check_dll)
138
138
  PE_DOS_HEADER dos = {};
139
139
  PE_NT_HEADERS nt = {};
140
140
 
141
- if (!ReadAt(h, 0, &dos, RG_SIZE(dos)))
141
+ if (!ReadAt(h, 0, &dos, K_SIZE(dos)))
142
142
  goto generic;
143
- if (!ReadAt(h, dos.e_lfanew, &nt, RG_SIZE(nt)))
143
+ if (!ReadAt(h, dos.e_lfanew, &nt, K_SIZE(nt)))
144
144
  goto generic;
145
145
 
146
146
  if (dos.e_magic != 0x5A4D) // MZ
@@ -179,7 +179,7 @@ int GetSelfMachine()
179
179
  LogError("Cannot open '%1': %2", filename, GetWin32ErrorString());
180
180
  return -1;
181
181
  }
182
- RG_DEFER { CloseHandle(h); };
182
+ K_DEFER { CloseHandle(h); };
183
183
 
184
184
  return GetFileMachine(h, false);
185
185
  }
@@ -193,7 +193,7 @@ int GetDllMachine(const wchar_t *filename)
193
193
  LogError("Cannot open '%1': %2", filename, GetWin32ErrorString());
194
194
  return -1;
195
195
  }
196
- RG_DEFER { CloseHandle(h); };
196
+ K_DEFER { CloseHandle(h); };
197
197
 
198
198
  return GetFileMachine(h, true);
199
199
  }
@@ -26,7 +26,7 @@
26
26
  #include <intrin.h>
27
27
  #include <napi.h>
28
28
 
29
- namespace RG {
29
+ namespace K {
30
30
 
31
31
  struct PE_DOS_HEADER {
32
32
  uint16_t e_magic;