Skip to content

Commit

Permalink
FREE Automatically Sets To NULL
Browse files Browse the repository at this point in the history
No need to explicitly sets variables to `NULL` after using `FREE` on
them, this is automatically done in `FREE` macro
  • Loading branch information
brightprogrammer committed Dec 20, 2024
1 parent 27a049c commit 5ea246b
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 7 deletions.
1 change: 0 additions & 1 deletion Include/Reai/Util/CStrVec.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ extern "C" {
RETURN_VALUE_IF (!clone || !*clone, (CString *)NULL, ERR_INVALID_ARGUMENTS);

FREE (*clone);
*clone = (CString)NULL;

return clone;
}
Expand Down
2 changes: 1 addition & 1 deletion Include/Reai/Util/Vec.h
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ extern "C" {
memmove ( \
vec->items + index, \
vec->items + index + 1, \
sizeof (vec_itype) * (vec->length - index - 1) \
sizeof (vec_itype) * (vec->count - index - 1) \
); \
vec->count--; \
\
Expand Down
2 changes: 0 additions & 2 deletions Source/Reai/Api/Reai.c
Original file line number Diff line number Diff line change
Expand Up @@ -154,12 +154,10 @@ void reai_destroy (Reai* reai) {

if (reai->host) {
FREE (reai->host);
reai->host = NULL;
}

if (reai->api_key) {
FREE (reai->api_key);
reai->api_key = NULL;
}

FREE (reai);
Expand Down
1 change: 0 additions & 1 deletion Source/Reai/Api/Response.c
Original file line number Diff line number Diff line change
Expand Up @@ -794,7 +794,6 @@ HIDDEN ReaiResponse* reai_response_reset (ReaiResponse* response) {
case REAI_RESPONSE_TYPE_RENAME_FUNCTION : {
if (response->rename_function.msg) {
FREE (response->rename_function.msg);
response->rename_function.msg = NULL;
}
}

Expand Down
2 changes: 0 additions & 2 deletions Source/Reai/ApiError.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,10 @@ ReaiApiError* reai_api_error_clone_deinit (ReaiApiError* clone) {

if (clone->code) {
FREE (clone->code);
clone->code = NULL;
}

if (clone->message) {
FREE (clone->message);
clone->message = NULL;
}

return clone;
Expand Down

0 comments on commit 5ea246b

Please sign in to comment.