Skip to content

Commit 0b357d4

Browse files
committed
utils: Use RB_ prefixed ALLOCV,ALLOC_END
Signed-off-by: Hiroshi Hatake <[email protected]>
1 parent 9987636 commit 0b357d4

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

ext/winevt/extconf.rb

+3
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
have_func("EvtQuery", "winevt.h")
1515
have_library("advapi32")
1616
have_library("ole32")
17+
if have_macro("RB_ALLOCV")
18+
$CFLAGS << " -DHAVE_RB_ALLOCV=1 "
19+
end
1720

1821
$LDFLAGS << " -lwevtapi -ladvapi32 -lole32"
1922
$CFLAGS << " -Wall -std=c99 -fPIC -fms-extensions "

ext/winevt/winevt_c.h

+5
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@
1616
#endif /* WIN32_WINNT */
1717
#define _WIN32_WINNT MINIMUM_WINDOWS_VERSION
1818

19+
#if !defined(HAVE_RB_ALLOCV)
20+
#define ALLOCV RB_ALLOCV
21+
#define ALLOCV_N RB_ALLOCV_N
22+
#endif
23+
1924
#include <time.h>
2025
#include <winevt.h>
2126
#define EventQuery(object) ((struct WinevtQuery*)DATA_PTR(object))

ext/winevt/winevt_utils.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -660,7 +660,7 @@ static int ExpandSIDWString(PSID sid, CHAR **out_expanded)
660660
}
661661

662662
result_len = strlen(domain) + 1 + strlen(account) + 1;
663-
formatted = (CHAR *)ALLOCV(vformatted, result_len);
663+
formatted = (CHAR *)RB_ALLOCV(vformatted, result_len);
664664
if (formatted == NULL) {
665665
goto error;
666666
}
@@ -675,7 +675,7 @@ static int ExpandSIDWString(PSID sid, CHAR **out_expanded)
675675
if (account != NULL) {
676676
free(account);
677677
}
678-
ALLOCV_END(vformatted);
678+
RB_ALLOCV_END(vformatted);
679679

680680

681681
return 0;

0 commit comments

Comments
 (0)