Skip to content

Commit 2733525

Browse files
committed
rename TFW_STR_FROM to TFW_STR_FROM_CSTR
1 parent a193c88 commit 2733525

File tree

8 files changed

+30
-30
lines changed

8 files changed

+30
-30
lines changed

tempesta_fw/http.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2141,9 +2141,9 @@ tfw_http_recreate_content_type_multipart_hdr(TfwHttpReq *req)
21412141
{
21422142
TfwStr replacement = {
21432143
.chunks = (TfwStr []) {
2144-
TFW_STR_FROM("Content-Type"),
2145-
TFW_STR_FROM(": "),
2146-
TFW_STR_FROM("multipart/form-data; boundary="),
2144+
TFW_STR_FROM_CSTR("Content-Type"),
2145+
TFW_STR_FROM_CSTR(": "),
2146+
TFW_STR_FROM_CSTR("multipart/form-data; boundary="),
21472147
req->multipart_boundary_raw,
21482148
},
21492149
.nchunks = 4,

tempesta_fw/http_parser.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1448,7 +1448,7 @@ __req_parse_content_type(TfwHttpMsg *hm, unsigned char *data, size_t len)
14481448

14491449
__FSM_STATE(I_ContTypeMediaType) {
14501450
static const TfwStr s_multipart_form_data =
1451-
TFW_STR_FROM("multipart/form-data");
1451+
TFW_STR_FROM_CSTR("multipart/form-data");
14521452
TRY_STR_LAMBDA_fixup(&s_multipart_form_data, &parser->hdr, {},
14531453
I_ContTypeMaybeMultipart);
14541454
if (chunk->len >= sizeof("multipart/") - 1) {
@@ -1497,7 +1497,7 @@ __req_parse_content_type(TfwHttpMsg *hm, unsigned char *data, size_t len)
14971497
}
14981498

14991499
__FSM_STATE(I_ContTypeParam) {
1500-
static const TfwStr s_boundary = TFW_STR_FROM("boundary=");
1500+
static const TfwStr s_boundary = TFW_STR_FROM_CSTR("boundary=");
15011501
if (!test_bit(TFW_HTTP_B_CT_MULTIPART, req->flags))
15021502
__FSM_I_JMP(I_ContTypeParamOther);
15031503

tempesta_fw/sock_clnt.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,7 @@ tfw_cfgop_listen(TfwCfgSpec *cs, TfwCfgEntry *ce)
480480
addr = tfw_addr_new_v4(INADDR_ANY, htons(port));
481481

482482
} else {
483-
r = tfw_addr_pton(&TFW_STR_FROM(in_str), &addr);
483+
r = tfw_addr_pton(&TFW_STR_FROM_CSTR(in_str), &addr);
484484
if (r)
485485
goto parse_err;
486486
}

tempesta_fw/sock_srv.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1323,7 +1323,7 @@ tfw_cfgop_server(TfwCfgSpec *cs, TfwCfgEntry *ce, TfwCfgSrvGroup *sg_cfg)
13231323
return -EINVAL;
13241324
}
13251325

1326-
if (tfw_addr_pton(&TFW_STR_FROM(ce->vals[0]), &addr)) {
1326+
if (tfw_addr_pton(&TFW_STR_FROM_CSTR(ce->vals[0]), &addr)) {
13271327
TFW_ERR_NL("Invalid IP address: '%s'\n", ce->vals[0]);
13281328
return -EINVAL;
13291329
}

tempesta_fw/str.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ typedef struct tfwstr_t {
219219
#define TFW_STR_STRING(val) ((TfwStr){.data = (val), NULL, \
220220
sizeof(val) - 1, 0, 0, 0})
221221
#define DEFINE_TFW_STR(name, val) TfwStr name = TFW_STR_STRING(val)
222-
#define TFW_STR_FROM(s) ((TfwStr){.data = (char*)s, \
222+
#define TFW_STR_FROM_CSTR(s) ((TfwStr){.data = (char*)s, \
223223
NULL, strlen(s), 0, 0, 0})
224224

225225
/* Use this with "%.*s" in printing calls. */

tempesta_fw/t/bomber.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,7 @@ tfw_bmb_init(void)
460460
struct task_struct *task;
461461
int r = 0;
462462

463-
if (tfw_addr_pton(&TFW_STR_FROM(server), &bmb_server_address)) {
463+
if (tfw_addr_pton(&TFW_STR_FROM_CSTR(server), &bmb_server_address)) {
464464
TFW_ERR("Unable to parse server's address: %s", server);
465465
return -EINVAL;
466466
}

tempesta_fw/t/unit/sched_helper.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ test_create_srv(const char *in_addr, TfwSrvGroup *sg)
158158
TfwServer *srv;
159159

160160
{
161-
int r = tfw_addr_pton(&TFW_STR_FROM(in_addr), &addr);
161+
int r = tfw_addr_pton(&TFW_STR_FROM_CSTR(in_addr), &addr);
162162
BUG_ON(r);
163163
}
164164

tempesta_fw/t/unit/test_tfw_str.c

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1104,11 +1104,11 @@ TEST(tfw_str_collect_cmp, collect_chunks)
11041104
{
11051105
TfwStr in = {
11061106
.chunks = (TfwStr []){
1107-
TFW_STR_FROM("abcd"),
1108-
TFW_STR_FROM("efghi"),
1109-
TFW_STR_FROM("jklmnopq"),
1110-
TFW_STR_FROM("rst"),
1111-
TFW_STR_FROM("uvwxyz")
1107+
TFW_STR_FROM_CSTR("abcd"),
1108+
TFW_STR_FROM_CSTR("efghi"),
1109+
TFW_STR_FROM_CSTR("jklmnopq"),
1110+
TFW_STR_FROM_CSTR("rst"),
1111+
TFW_STR_FROM_CSTR("uvwxyz")
11121112
},
11131113
.len = sizeof("abcdefghijklmnopqrstuvwxyz") - 1,
11141114
.nchunks = 5
@@ -1331,11 +1331,11 @@ TEST(tfw_str_del_chunk, first)
13311331
{
13321332
TfwStr s = {
13331333
.chunks = (TfwStr []){
1334-
TFW_STR_FROM("abcd"),
1335-
TFW_STR_FROM("efghi"),
1336-
TFW_STR_FROM("jklmnopq"),
1337-
TFW_STR_FROM("rst"),
1338-
TFW_STR_FROM("uvwxyz")
1334+
TFW_STR_FROM_CSTR("abcd"),
1335+
TFW_STR_FROM_CSTR("efghi"),
1336+
TFW_STR_FROM_CSTR("jklmnopq"),
1337+
TFW_STR_FROM_CSTR("rst"),
1338+
TFW_STR_FROM_CSTR("uvwxyz")
13391339
},
13401340
.len = SLEN("abcdefghijklmnopqrstuvwxyz"),
13411341
.nchunks = 5
@@ -1351,11 +1351,11 @@ TEST(tfw_str_del_chunk, middle)
13511351
{
13521352
TfwStr s = {
13531353
.chunks = (TfwStr []){
1354-
TFW_STR_FROM("abcd"),
1355-
TFW_STR_FROM("efghi"),
1356-
TFW_STR_FROM("jklmnopq"),
1357-
TFW_STR_FROM("rst"),
1358-
TFW_STR_FROM("uvwxyz")
1354+
TFW_STR_FROM_CSTR("abcd"),
1355+
TFW_STR_FROM_CSTR("efghi"),
1356+
TFW_STR_FROM_CSTR("jklmnopq"),
1357+
TFW_STR_FROM_CSTR("rst"),
1358+
TFW_STR_FROM_CSTR("uvwxyz")
13591359
},
13601360
.len = SLEN("abcdefghijklmnopqrstuvwxyz"),
13611361
.nchunks = 5
@@ -1371,11 +1371,11 @@ TEST(tfw_str_del_chunk, last)
13711371
{
13721372
TfwStr s = {
13731373
.chunks = (TfwStr []){
1374-
TFW_STR_FROM("abcd"),
1375-
TFW_STR_FROM("efghi"),
1376-
TFW_STR_FROM("jklmnopq"),
1377-
TFW_STR_FROM("rst"),
1378-
TFW_STR_FROM("uvwxyz")
1374+
TFW_STR_FROM_CSTR("abcd"),
1375+
TFW_STR_FROM_CSTR("efghi"),
1376+
TFW_STR_FROM_CSTR("jklmnopq"),
1377+
TFW_STR_FROM_CSTR("rst"),
1378+
TFW_STR_FROM_CSTR("uvwxyz")
13791379
},
13801380
.len = SLEN("abcdefghijklmnopqrstuvwxyz"),
13811381
.nchunks = 5

0 commit comments

Comments
 (0)