Single fcore reference for tus_file_final_birth()

parent 345a6d35
......@@ -204,14 +204,16 @@ tus_file_final_concat(struct VPFX(tus_server) *srv,
return (NULL);
}
struct tus_file_core *
tus_file_final_birth(struct tus_file_core *fcore, struct concat_embryo *embryo)
void
tus_file_final_birth(struct tus_file_core **fcorep,
struct concat_embryo *embryo)
{
struct tus_file_core *fcore;
struct VPFX(tus_server) *srv;
struct tus_file_disk *fdisk;
struct vsb *vsb;
CHECK_OBJ_NOTNULL(fcore, VMOD_TUS_FILE_CORE_MAGIC);
TAKE_OBJ_NOTNULL(fcore, fcorep, VMOD_TUS_FILE_CORE_MAGIC);
CHECK_OBJ_NOTNULL(embryo, CONCAT_EMBRYO_MAGIC);
fdisk = fcore->disk;
CHECK_OBJ_NOTNULL(fdisk, VMOD_TUS_FILE_DISK_MAGIC);
......@@ -232,7 +234,7 @@ tus_file_final_birth(struct tus_file_core *fcore, struct concat_embryo *embryo)
}
VSB_destroy(&vsb);
memset(embryo, 0, sizeof *embryo);
return (fcore);
*fcorep = fcore;
}
static void
......
......@@ -168,8 +168,7 @@ struct concat_embryo * tus_file_final_concat(struct VPFX(tus_server) *,
struct concat_embryo *, const char *);
VCL_BLOB tus_concat_hash(VRT_CTX, const struct VPFX(tus_server) *,
const struct tus_concat *);
struct tus_file_core *tus_file_final_birth(struct tus_file_core *,
struct concat_embryo *);
void tus_file_final_birth(struct tus_file_core **, struct concat_embryo *);
void tus_file_final_abort(struct concat_embryo *);
VCL_BOOL tus_file_done(struct tus_file_core *, struct tus_file_disk *,
const char *);
......
......@@ -351,8 +351,8 @@ tus_request(VRT_CTX, struct VPFX(tus_server) *tussrv,
if (r->fcore == NULL) {
tus_file_final_abort(&embryo);
} else {
r->fcore = tus_file_final_birth(r->fcore, &embryo);
r->status = 201;
tus_file_final_birth(&r->fcore, &embryo);
r->status = r->fcore ? 201 : 500;
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment