aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--subhook.c16
-rw-r--r--subhook_private.h7
-rw-r--r--subhook_x86.c13
3 files changed, 18 insertions, 18 deletions
diff --git a/subhook.c b/subhook.c
index 1e3beb0..a0433eb 100644
--- a/subhook.c
+++ b/subhook.c
@@ -27,29 +27,29 @@
#include "subhook_private.h"
SUBHOOK_EXPORT void *SUBHOOK_API subhook_get_src(subhook_t hook) {
- if (!hook) {
- return 0;
+ if (hook == NULL) {
+ return NULL;
}
return hook->src;
}
SUBHOOK_EXPORT void *SUBHOOK_API subhook_get_dst(subhook_t hook) {
- if (!hook) {
- return 0;
+ if (hook == NULL) {
+ return NULL;
}
return hook->dst;
}
SUBHOOK_EXPORT void *SUBHOOK_API subhook_get_trampoline(subhook_t hook) {
- if (!hook) {
- return 0;
+ if (hook == NULL) {
+ return NULL;
}
return hook->trampoline;
}
SUBHOOK_EXPORT int SUBHOOK_API subhook_is_installed(subhook_t hook) {
- if (!hook) {
- return 0;
+ if (hook == NULL) {
+ return false;
}
return hook->installed;
}
diff --git a/subhook_private.h b/subhook_private.h
index 3f80b73..0458969 100644
--- a/subhook_private.h
+++ b/subhook_private.h
@@ -28,6 +28,13 @@
#include <stddef.h>
+#ifndef true
+ #define true 1
+#endif
+#ifndef false
+ #define false 0
+#endif
+
struct subhook_struct {
int installed;
void *src;
diff --git a/subhook_x86.c b/subhook_x86.c
index 1d87b47..688fb88 100644
--- a/subhook_x86.c
+++ b/subhook_x86.c
@@ -50,13 +50,6 @@
#include <stdint.h>
#endif
-#ifndef true
- #define true 1
-#endif
-#ifndef false
- #define false 0
-#endif
-
#define MAX_INSN_LEN 15 /* maximum length of x86 instruction */
#define JMP_OPCODE 0xE9
@@ -444,7 +437,7 @@ SUBHOOK_EXPORT subhook_t SUBHOOK_API subhook_new(void *src,
}
SUBHOOK_EXPORT void SUBHOOK_API subhook_free(subhook_t hook) {
- if (!hook) {
+ if (hook == NULL) {
return;
}
free(hook->trampoline);
@@ -455,7 +448,7 @@ SUBHOOK_EXPORT void SUBHOOK_API subhook_free(subhook_t hook) {
SUBHOOK_EXPORT int SUBHOOK_API subhook_install(subhook_t hook) {
int error;
- if (!hook) {
+ if (hook == NULL) {
return -EINVAL;
}
if (hook->installed) {
@@ -472,7 +465,7 @@ SUBHOOK_EXPORT int SUBHOOK_API subhook_install(subhook_t hook) {
}
SUBHOOK_EXPORT int SUBHOOK_API subhook_remove(subhook_t hook) {
- if (!hook) {
+ if (hook == NULL) {
return -EINVAL;
}
if (!hook->installed) {