Skip to content

Commit f8756ab

Browse files
committed
Don't compute table size every return.
1 parent df3eaca commit f8756ab

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

hooks/Hooks.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ struct HookStorage
341341
class HookToReadableString
342342
{
343343
public:
344-
static std::pair<const HookStorage*, size_t> getHooks() { return {HookMegaTable, sizeof(HookMegaTable) / sizeof(HookMegaTable[0])}; }
344+
static std::pair<const HookStorage*, size_t> getHooks() { return {HookMegaTable, HookMegaTableSize}; }
345345

346346
private:
347347
static constexpr EventEntry PacketEventsTable[] = {
@@ -572,6 +572,7 @@ class HookToReadableString
572572
{ "bg", BGEventsTable, sizeof(BGEventsTable) / sizeof(BGEventsTable[0])},
573573
{ "instance", InstanceEventsTable, sizeof(InstanceEventsTable) / sizeof(InstanceEventsTable[0])},
574574
};
575+
static constexpr size_t HookMegaTableSize = sizeof(HookMegaTable) / sizeof(HookMegaTable[0]);
575576
};
576577

577578
#endif // _HOOKS_H

0 commit comments

Comments
 (0)