-
Notifications
You must be signed in to change notification settings - Fork 390
Stash objcore references until the end of the task to avoid copies #4269
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
base: master
Are you sure you want to change the base?
Changes from 1 commit
5575ff4
487d9d8
429e1e0
191be48
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -93,14 +93,6 @@ VRT_synth(VRT_CTX, VCL_INT code, VCL_STRING reason) | |
return; | ||
} | ||
|
||
if (reason && !WS_Allocated(ctx->ws, reason, -1)) { | ||
reason = WS_Copy(ctx->ws, reason, -1); | ||
if (!reason) { | ||
VRT_fail(ctx, "Workspace overflow"); | ||
return; | ||
} | ||
} | ||
|
||
if (ctx->req == NULL) { | ||
CHECK_OBJ_NOTNULL(ctx->bo, BUSYOBJ_MAGIC); | ||
ctx->bo->err_code = (uint16_t)code; | ||
|
@@ -445,12 +437,11 @@ VRT_StrandsWS(struct ws *ws, const char *h, VCL_STRANDS s) | |
} | ||
} | ||
|
||
if (q == NULL) { | ||
if (h == NULL) | ||
return (""); | ||
if (WS_Allocated(ws, h, -1)) | ||
return (h); | ||
} else if (h == NULL && WS_Allocated(ws, q, -1)) { | ||
if (q == NULL && h == NULL) | ||
return (""); | ||
if (q == NULL) | ||
return (h); | ||
if (h == NULL) { | ||
Comment on lines
-448
to
+444
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Likewise, we can't assume a task lifetime of the arguments. |
||
for (i++; i < s->n; i++) | ||
if (s->p[i] != NULL && *s->p[i] != '\0') | ||
break; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -645,8 +645,6 @@ xyzzy_concatenate(VRT_CTX, VCL_STRANDS s) | |
|
||
CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); | ||
r = VRT_StrandsWS(ctx->ws, NULL, s); | ||
if (r != NULL && *r != '\0') | ||
AN(WS_Allocated(ctx->ws, r, strlen(r) + 1)); | ||
Comment on lines
647
to
-649
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If our concern is coverage for |
||
return (r); | ||
} | ||
|
||
|
@@ -657,8 +655,6 @@ xyzzy_collect(VRT_CTX, VCL_STRANDS s) | |
|
||
CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); | ||
r = VRT_STRANDS_string(ctx, s); | ||
if (r != NULL && *r != '\0') | ||
AN(WS_Allocated(ctx->ws, r, strlen(r) + 1)); | ||
Comment on lines
-660
to
-661
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See previous. |
||
return (r); | ||
} | ||
|
||
|
@@ -690,8 +686,6 @@ xyzzy_sethdr(VRT_CTX, VCL_HEADER hdr, VCL_STRANDS s) | |
VSLbs(ctx->vsl, SLT_LostHeader, | ||
TOSTRAND(hdr->what + 1)); | ||
} else { | ||
if (*b != '\0') | ||
AN(WS_Allocated(hp->ws, b, strlen(b) + 1)); | ||
Comment on lines
-693
to
-694
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See previous. |
||
http_Unset(hp, hdr->what); | ||
http_SetHeader(hp, b); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This might not be safe actually:
In that case we can't assume a lifetime beyond the
VRT_synth()
call for thereason
argument.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see #4269 (comment) regarding this and the next four review comments.