-
Notifications
You must be signed in to change notification settings - Fork 153
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
internals: refactor error handling #42
Labels
Comments
Please, try the following patch
|
The patch works for me. diff --git a/njs/njs_json.c b/njs/njs_json.c
--- a/njs/njs_json.c
+++ b/njs/njs_json.c
@@ -535,7 +535,6 @@ njs_json_parse_array(njs_json_parse_ctx_
array = njs_array_alloc(ctx->vm, 0, 0);
if (nxt_slow_path(array == NULL)) {
- njs_memory_error(ctx->vm);
return NULL;
}
@@ -812,7 +811,6 @@ njs_json_parse_string(njs_json_parse_ctx
ret = njs_string_create(ctx->vm, value, (u_char *) start, size, length);
if (nxt_slow_path(ret != NXT_OK)) {
- njs_memory_error(ctx->vm);
return NULL;
}
diff --git a/njs/njs_string.c b/njs/njs_string.c
--- a/njs/njs_string.c
+++ b/njs/njs_string.c
@@ -292,8 +292,6 @@ njs_string_hex(njs_vm_t *vm, njs_value_t
return NXT_OK;
}
- njs_memory_error(vm);
-
return NXT_ERROR;
}
@@ -385,7 +383,6 @@ njs_string_base64(njs_vm_t *vm, njs_valu
dst.start = njs_string_alloc(vm, &vm->retval, dst.length, dst.length);
if (nxt_slow_path(dst.start == NULL)) {
- njs_memory_error(vm);
return NXT_ERROR;
}
@@ -417,7 +414,6 @@ njs_string_base64url(njs_vm_t *vm, njs_v
dst.start = njs_string_alloc(vm, &vm->retval, dst.length, dst.length);
if (nxt_slow_path(dst.start == NULL)) {
- njs_memory_error(vm);
return NXT_ERROR;
}
@@ -1063,8 +1059,6 @@ njs_string_prototype_to_bytes(njs_vm_t *
return NXT_OK;
}
- njs_memory_error(vm);
-
return NXT_ERROR;
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
While looking into #41 I've found a ...
here
njs_memory_error
will be called twice:njs/njs/njs_string.c
Lines 177 to 179 in bd2e5d8
here it wont be called at all:
njs/njs/njs_string.c
Lines 149 to 151 in bd2e5d8
but the return value of
njs_string_create
is used directly in many top level functions.here:
njs/njs/njs_array.c
Line 268 in bd2e5d8
and so on...
The text was updated successfully, but these errors were encountered: