From fc22e1784c52efd662949b7d965ba1aae9d55f8c Mon Sep 17 00:00:00 2001 From: Maksym Sobolyev Date: Fri, 29 Jan 2021 09:32:35 -0800 Subject: [PATCH] Use const_str() not _str() when generating point of use literals to be used in str_match() / str_casematch(). As discussed with @liviuchircu here https://github.com/OpenSIPS/opensips/commit/0147baa21072c5b9#commitcomment-46519279 it saves us some code size and also should have at least some positive performance effect by not saving 2 values into memory that nobody reads. --- lib/reg/pn.c | 2 +- lib/test/test_csv.c | 82 +++++++++++++++--------------- modules/dialplan/dialplan.c | 6 +-- modules/dialplan/dp_db.c | 2 +- modules/fraud_detection/frd_load.c | 6 +-- parser/parse_uri.h | 24 ++++----- parser/test/test_parse_fcaps.c | 18 +++---- parser/test/test_parser.c | 60 +++++++++++----------- 8 files changed, 100 insertions(+), 100 deletions(-) diff --git a/lib/reg/pn.c b/lib/reg/pn.c index 85297aaae84..5d37c253a57 100644 --- a/lib/reg/pn.c +++ b/lib/reg/pn.c @@ -545,7 +545,7 @@ static struct usr_avp *pn_trim_pn_params(evi_params_t *params) } /* the Contact URI is the only EVI param we're interested in */ - if (str_match(&p->name, _str(UL_EV_PARAM_CT_URI)) && + if (str_match(&p->name, const_str(UL_EV_PARAM_CT_URI)) && pn_has_uri_params(&p->val.s, &puri)) { if (pn_remove_uri_params(&puri, p->val.s.len, &_sval) != 0) { LM_ERR("failed to remove PN params from Contact '%.*s'\n", diff --git a/lib/test/test_csv.c b/lib/test/test_csv.c index b49dfc02ab1..8deff0d4a81 100644 --- a/lib/test/test_csv.c +++ b/lib/test/test_csv.c @@ -30,43 +30,43 @@ void test_csv_simple(void) csv_record *ret; ret = parse_csv_record(_str("")); - ok(str_match(&ret->s, _str(""))); + ok(str_match(&ret->s, const_str(""))); ok(!ret->next); free_csv_record(ret); ret = parse_csv_record(_str("\t\r\n ")); - ok(str_match(&ret->s, _str(""))); + ok(str_match(&ret->s, const_str(""))); ok(!ret->next); free_csv_record(ret); ret = parse_csv_record(_str(" a b ")); - ok(str_match(&ret->s, _str("a b"))); + ok(str_match(&ret->s, const_str("a b"))); ok(!ret->next); free_csv_record(ret); ret = parse_csv_record(_str(" a , ")); - ok(str_match(&ret->s, _str("a"))); - ok(str_match(&ret->next->s, _str(""))); + ok(str_match(&ret->s, const_str("a"))); + ok(str_match(&ret->next->s, const_str(""))); ok(!ret->next->next); free_csv_record(ret); ret = parse_csv_record(_str(" , a ")); - ok(str_match(&ret->s, _str(""))); - ok(str_match(&ret->next->s, _str("a"))); + ok(str_match(&ret->s, const_str(""))); + ok(str_match(&ret->next->s, const_str("a"))); ok(!ret->next->next); free_csv_record(ret); ret = parse_csv_record(_str("a,b,c")); - ok(str_match(&ret->s, _str("a"))); - ok(str_match(&ret->next->s, _str("b"))); - ok(str_match(&ret->next->next->s, _str("c"))); + ok(str_match(&ret->s, const_str("a"))); + ok(str_match(&ret->next->s, const_str("b"))); + ok(str_match(&ret->next->next->s, const_str("c"))); ok(!ret->next->next->next); free_csv_record(ret); ret = parse_csv_record(_str(" a, \"b\" , \" c ")); - ok(str_match(&ret->s, _str("a"))); - ok(str_match(&ret->next->s, _str("\"b\""))); - ok(str_match(&ret->next->next->s, _str("\" c"))); + ok(str_match(&ret->s, const_str("a"))); + ok(str_match(&ret->next->s, const_str("\"b\""))); + ok(str_match(&ret->next->next->s, const_str("\" c"))); ok(!ret->next->next->next); free_csv_record(ret); } @@ -84,50 +84,50 @@ void test_csv_rfc_4180(void) ok(!_parse_csv_record(_str("a,b,c\t"), CSV_RFC_4180)); ret = _parse_csv_record(_str(""), CSV_RFC_4180); - ok(str_match(&ret->s, _str(""))); + ok(str_match(&ret->s, const_str(""))); ok(!ret->next); free_csv_record(ret); ret = _parse_csv_record(_str(" a "), CSV_RFC_4180); - ok(str_match(&ret->s, _str(" a "))); + ok(str_match(&ret->s, const_str(" a "))); ok(!ret->next); free_csv_record(ret); ret = _parse_csv_record(_str(" \r\n"), CSV_RFC_4180); - ok(str_match(&ret->s, _str(" "))); + ok(str_match(&ret->s, const_str(" "))); ok(!ret->next); free_csv_record(ret); ret = _parse_csv_record(_str(","), CSV_RFC_4180); - ok(str_match(&ret->s, _str(""))); - ok(str_match(&ret->next->s, _str(""))); + ok(str_match(&ret->s, const_str(""))); + ok(str_match(&ret->next->s, const_str(""))); ok(!ret->next->next); free_csv_record(ret); ret = _parse_csv_record(_str("a,,,"), CSV_RFC_4180); - ok(str_match(&ret->s, _str("a"))); - ok(str_match(&ret->next->s, _str(""))); - ok(str_match(&ret->next->next->s, _str(""))); - ok(str_match(&ret->next->next->next->s, _str(""))); + ok(str_match(&ret->s, const_str("a"))); + ok(str_match(&ret->next->s, const_str(""))); + ok(str_match(&ret->next->next->s, const_str(""))); + ok(str_match(&ret->next->next->next->s, const_str(""))); ok(!ret->next->next->next->next); free_csv_record(ret); ret = _parse_csv_record(_str(" , a "), CSV_RFC_4180); - ok(str_match(&ret->s, _str(" "))); - ok(str_match(&ret->next->s, _str(" a "))); + ok(str_match(&ret->s, const_str(" "))); + ok(str_match(&ret->next->s, const_str(" a "))); ok(!ret->next->next); free_csv_record(ret); ret = _parse_csv_record(_str(" a , \r\n"), CSV_RFC_4180); - ok(str_match(&ret->s, _str(" a "))); - ok(str_match(&ret->next->s, _str(" "))); + ok(str_match(&ret->s, const_str(" a "))); + ok(str_match(&ret->next->s, const_str(" "))); ok(!ret->next->next); free_csv_record(ret); ret = _parse_csv_record(_str("a,b,c"), CSV_RFC_4180); - ok(str_match(&ret->s, _str("a"))); - ok(str_match(&ret->next->s, _str("b"))); - ok(str_match(&ret->next->next->s, _str("c"))); + ok(str_match(&ret->s, const_str("a"))); + ok(str_match(&ret->next->s, const_str("b"))); + ok(str_match(&ret->next->next->s, const_str("c"))); ok(!ret->next->next->next); free_csv_record(ret); @@ -137,30 +137,30 @@ void test_csv_rfc_4180(void) ok(!_parse_csv_record(_str("\"a\"a,b"), CSV_RFC_4180)); ret = _parse_csv_record(_str("\"a\""), CSV_RFC_4180); - ok(str_match(&ret->s, _str("a"))); + ok(str_match(&ret->s, const_str("a"))); ok(!ret->next); free_csv_record(ret); ret = _parse_csv_record(_str("realm=\"etc.example.com\"," "nonce=\"B5CFDSFDGD14992F\",opaque=\"opaq\"," "qop=\"auth\",algorithm=MD5"), CSV_RFC_4180); - ok(str_match(&ret->s, _str("realm=\"etc.example.com\""))); - ok(str_match(&ret->next->s, _str("nonce=\"B5CFDSFDGD14992F\""))); - ok(str_match(&ret->next->next->s, _str("opaque=\"opaq\""))); - ok(str_match(&ret->next->next->next->s, _str("qop=\"auth\""))); - ok(str_match(&ret->next->next->next->next->s, _str("algorithm=MD5"))); + ok(str_match(&ret->s, const_str("realm=\"etc.example.com\""))); + ok(str_match(&ret->next->s, const_str("nonce=\"B5CFDSFDGD14992F\""))); + ok(str_match(&ret->next->next->s, const_str("opaque=\"opaq\""))); + ok(str_match(&ret->next->next->next->s, const_str("qop=\"auth\""))); + ok(str_match(&ret->next->next->next->next->s, const_str("algorithm=MD5"))); ok(!ret->next->next->next->next->next); free_csv_record(ret); ret = _parse_csv_record(_str("a,\"\tb\""), CSV_RFC_4180); - ok(str_match(&ret->s, _str("a"))); - ok(str_match(&ret->next->s, _str("\tb"))); + ok(str_match(&ret->s, const_str("a"))); + ok(str_match(&ret->next->s, const_str("\tb"))); ok(!ret->next->next); free_csv_record(ret); ret = _parse_csv_record(_str("\"a\", bc "), CSV_RFC_4180); - ok(str_match(&ret->s, _str("a"))); - ok(str_match(&ret->next->s, _str(" bc "))); + ok(str_match(&ret->s, const_str("a"))); + ok(str_match(&ret->next->s, const_str(" bc "))); ok(!ret->next->next); free_csv_record(ret); @@ -171,8 +171,8 @@ void test_csv_rfc_4180(void) ret = _parse_csv_record(_str("\"\"\"a\"\" \r\"\"\t\nb\"\" \",\"c\"\r\n"), CSV_RFC_4180); - ok(str_match(&ret->s, _str("\"a\" \r\"\t\nb\" "))); - ok(str_match(&ret->next->s, _str("c"))); + ok(str_match(&ret->s, const_str("\"a\" \r\"\t\nb\" "))); + ok(str_match(&ret->next->s, const_str("c"))); ok(!ret->next->next); free_csv_record(ret); } diff --git a/modules/dialplan/dialplan.c b/modules/dialplan/dialplan.c index 6c65d07777f..8a176672a2d 100644 --- a/modules/dialplan/dialplan.c +++ b/modules/dialplan/dialplan.c @@ -266,10 +266,10 @@ static int dp_create_head(const str *in) return 0; } - if (str_match(¶ms->s, _str(PARAM_URL))) { + if (str_match(¶ms->s, const_str(PARAM_URL))) { have_db_url = 1; dp_head_insert(DP_TYPE_URL, ¶ms->next->s, &partition); - } else if (str_match(¶ms->s, _str(PARAM_TABLE))) { + } else if (str_match(¶ms->s, const_str(PARAM_TABLE))) { have_db_table = 1; dp_head_insert(DP_TYPE_TABLE, ¶ms->next->s, &partition); } else if (!ZSTR(params->s)) { @@ -359,7 +359,7 @@ static int mod_init(void) timerec_column.len = strlen(timerec_column.s); disabled_column.len = strlen(disabled_column.s); - if (!dp_df_head && str_match(&dp_df_part, _str(DEFAULT_PARTITION)) && + if (!dp_df_head && str_match(&dp_df_part, const_str(DEFAULT_PARTITION)) && default_dp_db_url.s) { dp_head_insert(DP_TYPE_URL, &default_dp_db_url, &dp_df_part); dp_head_insert(DP_TYPE_TABLE, &default_dp_table, &dp_df_part); diff --git a/modules/dialplan/dp_db.c b/modules/dialplan/dp_db.c index 9bcafa04571..25f72a968e2 100644 --- a/modules/dialplan/dp_db.c +++ b/modules/dialplan/dp_db.c @@ -176,7 +176,7 @@ int init_data(void) } /* was the default partition re-pointed? */ - if (!str_match(&dp_df_part, _str(DEFAULT_PARTITION))) { + if (!str_match(&dp_df_part, const_str(DEFAULT_PARTITION))) { int found = 0; for (start = dp_hlist; start; start = start->next) { diff --git a/modules/fraud_detection/frd_load.c b/modules/fraud_detection/frd_load.c index 986d3283159..3788717831c 100644 --- a/modules/fraud_detection/frd_load.c +++ b/modules/fraud_detection/frd_load.c @@ -231,9 +231,9 @@ static int create_time_rec(const str *time_start, const str *time_end, tmrec_p trec = &trx->tr; /* the default, "catch-all" time rec - using NULL is optimal */ - if (str_match(time_start, _str("00:00")) && - str_match(time_end, _str("23:59")) && - str_match(week_days, _str("Mon-Sun"))) { + if (str_match(time_start, const_str("00:00")) && + str_match(time_end, const_str("23:59")) && + str_match(week_days, const_str("Mon-Sun"))) { *out_rec = NULL; return 0; } else { diff --git a/parser/parse_uri.h b/parser/parse_uri.h index 51ca41aaaac..865413410cd 100644 --- a/parser/parse_uri.h +++ b/parser/parse_uri.h @@ -127,22 +127,22 @@ static inline int get_uri_param_val(const struct sip_uri *uri, switch (param->s[0]) { case 'p': case 'P': - if (str_casematch(param, _str("pn-provider"))) { + if (str_casematch(param, const_str("pn-provider"))) { *val = uri->pn_provider_val; return 0; } - if (str_casematch(param, _str("pn-prid"))) { + if (str_casematch(param, const_str("pn-prid"))) { *val = uri->pn_prid_val; return 0; } - if (str_casematch(param, _str("pn-param"))) { + if (str_casematch(param, const_str("pn-param"))) { *val = uri->pn_param_val; return 0; } - if (str_casematch(param, _str("pn-purr"))) { + if (str_casematch(param, const_str("pn-purr"))) { *val = uri->pn_purr_val; return 0; } @@ -150,12 +150,12 @@ static inline int get_uri_param_val(const struct sip_uri *uri, case 't': case 'T': - if (str_casematch(param, _str("transport"))) { + if (str_casematch(param, const_str("transport"))) { *val = uri->transport_val; return 0; } - if (str_casematch(param, _str("ttl"))) { + if (str_casematch(param, const_str("ttl"))) { *val = uri->ttl_val; return 0; } @@ -163,7 +163,7 @@ static inline int get_uri_param_val(const struct sip_uri *uri, case 'u': case 'U': - if (str_casematch(param, _str("user"))) { + if (str_casematch(param, const_str("user"))) { *val = uri->user_param_val; return 0; } @@ -171,12 +171,12 @@ static inline int get_uri_param_val(const struct sip_uri *uri, case 'm': case 'M': - if (str_casematch(param, _str("maddr"))) { + if (str_casematch(param, const_str("maddr"))) { *val = uri->maddr_val; return 0; } - if (str_casematch(param, _str("method"))) { + if (str_casematch(param, const_str("method"))) { *val = uri->method_val; return 0; } @@ -184,7 +184,7 @@ static inline int get_uri_param_val(const struct sip_uri *uri, case 'l': case 'L': - if (str_casematch(param, _str("lr"))) { + if (str_casematch(param, const_str("lr"))) { *val = uri->lr_val; return 0; } @@ -192,7 +192,7 @@ static inline int get_uri_param_val(const struct sip_uri *uri, case 'r': case 'R': - if (str_casematch(param, _str("r2"))) { + if (str_casematch(param, const_str("r2"))) { *val = uri->r2_val; return 0; } @@ -200,7 +200,7 @@ static inline int get_uri_param_val(const struct sip_uri *uri, case 'g': case 'G': - if (str_casematch(param, _str("gr"))) { + if (str_casematch(param, const_str("gr"))) { *val = uri->gr_val; return 0; } diff --git a/parser/test/test_parse_fcaps.c b/parser/test/test_parse_fcaps.c index 127e770960d..9c58b81e246 100644 --- a/parser/test/test_parse_fcaps.c +++ b/parser/test/test_parse_fcaps.c @@ -35,25 +35,25 @@ void test_parse_fcaps(void) memset(&hf, 0, sizeof hf); get_hdr_field(hdr->s, hdr->s + hdr->len, &hf); ok(hf.type == HDR_FEATURE_CAPS_T, "fcaps-1"); - ok(str_match(&hf.body, _str("+sip.pns=\"apns\"")), "fcaps-2"); + ok(str_match(&hf.body, const_str("+sip.pns=\"apns\"")), "fcaps-2"); hdr = _str("fEATURE-cAPS:+sip.pns=\"apns\"\r\n"); memset(&hf, 0, sizeof hf); get_hdr_field(hdr->s, hdr->s + hdr->len, &hf); ok(hf.type == HDR_FEATURE_CAPS_T, "fcaps-3"); - ok(str_match(&hf.body, _str("+sip.pns=\"apns\"")), "fcaps-4"); + ok(str_match(&hf.body, const_str("+sip.pns=\"apns\"")), "fcaps-4"); hdr = _str("feature-caps: +sip.pns=\"apns\";+sip.pnsreg=\"130\"\r\n"); memset(&hf, 0, sizeof hf); get_hdr_field(hdr->s, hdr->s + hdr->len, &hf); ok(hf.type == HDR_FEATURE_CAPS_T, "fcaps-5"); - ok(str_match(&hf.body, _str("+sip.pns=\"apns\";+sip.pnsreg=\"130\"")), "fcaps-6"); + ok(str_match(&hf.body, const_str("+sip.pns=\"apns\";+sip.pnsreg=\"130\"")), "fcaps-6"); free_fcaps((fcaps_body_t**)&hf.parsed); ok(!hf.parsed, "fcaps-7"); ok(parse_fcaps(&hf) == 0, "fcaps-8"); fcaps = (fcaps_body_t *)hf.parsed; - ok(str_match(&fcaps->pns, _str("apns")), "fcaps-9"); + ok(str_match(&fcaps->pns, const_str("apns")), "fcaps-9"); free_fcaps((fcaps_body_t**)&hf.parsed); hf.body = *_str(""); @@ -80,30 +80,30 @@ void test_parse_fcaps(void) hf.body = *_str("+sip.pns=\"x\""); ok(parse_fcaps(&hf) == 0, "fcaps-17"); fcaps = (fcaps_body_t *)hf.parsed; - ok(str_match(&fcaps->pns, _str("x")), "fcaps-18"); + ok(str_match(&fcaps->pns, const_str("x")), "fcaps-18"); free_fcaps((fcaps_body_t**)&hf.parsed); hf.body = *_str("+sip.pns=\"apns\";+sip.pns=130\";+sip.pns=\"fcm\"+sip.pns+sip.pns=\"x"); ok(parse_fcaps(&hf) == 0, "fcaps-19"); fcaps = (fcaps_body_t *)hf.parsed; - ok(str_match(&fcaps->pns, _str("fcm")), "fcaps-20"); + ok(str_match(&fcaps->pns, const_str("fcm")), "fcaps-20"); free_fcaps((fcaps_body_t**)&hf.parsed); hf.body = *_str("+sip.pns=\"apns\";+sip.pns=130\";+sip.pns=\"fcm\"+sip.pns+sip.pns=\"x"); ok(parse_fcaps(&hf) == 0, "fcaps-21"); fcaps = (fcaps_body_t *)hf.parsed; - ok(str_match(&fcaps->pns, _str("fcm")), "fcaps-22"); + ok(str_match(&fcaps->pns, const_str("fcm")), "fcaps-22"); free_fcaps((fcaps_body_t**)&hf.parsed); hf.body = *_str("+sip.pns=\"apns\";+sip.pns=130\";+sip.pns=\"fcm\"+sip.pns+sip.pns=\"3"); ok(parse_fcaps(&hf) == 0, "fcaps-23"); fcaps = (fcaps_body_t *)hf.parsed; - ok(str_match(&fcaps->pns, _str("fcm")), "fcaps-24"); + ok(str_match(&fcaps->pns, const_str("fcm")), "fcaps-24"); free_fcaps((fcaps_body_t**)&hf.parsed); hf.body = *_str("+sip.pns=\"apns\";+sip.pns=130\";+sip.pns=\"fcm\"+sip.pns+sip.pns=3;+sip.pns=\"webpush\""); ok(parse_fcaps(&hf) == 0, "fcaps-25"); fcaps = (fcaps_body_t *)hf.parsed; - ok(str_match(&fcaps->pns, _str("webpush")), "fcaps-26"); + ok(str_match(&fcaps->pns, const_str("webpush")), "fcaps-26"); free_fcaps((fcaps_body_t**)&hf.parsed); } diff --git a/parser/test/test_parser.c b/parser/test/test_parser.c index b16d9d1847b..10a6bc7bddc 100644 --- a/parser/test/test_parser.c +++ b/parser/test/test_parser.c @@ -49,48 +49,48 @@ void test_parse_uri(void) in = *_str("sip:alice@atlanta.org;user=phone"); ok(parse_uri(in.s, in.len, &u) == 0, "puri-1"); - ok(str_match(&u.user_param, _str("user=phone")), "puri-2"); - ok(str_match(&u.user_param_val, _str("phone")), "puri-3"); + ok(str_match(&u.user_param, const_str("user=phone")), "puri-2"); + ok(str_match(&u.user_param_val, const_str("phone")), "puri-3"); in = *_str("sip:alice@atlanta.org;user=phone;gr=x"); ok(parse_uri(in.s, in.len, &u) == 0, "puri-4"); - ok(str_match(&u.user_param, _str("user=phone")), "puri-5"); - ok(str_match(&u.user_param_val, _str("phone")), "puri-6"); - ok(str_match(&u.gr, _str("gr=x")), "puri-7"); - ok(str_match(&u.gr_val, _str("x")), "puri-8"); + ok(str_match(&u.user_param, const_str("user=phone")), "puri-5"); + ok(str_match(&u.user_param_val, const_str("phone")), "puri-6"); + ok(str_match(&u.gr, const_str("gr=x")), "puri-7"); + ok(str_match(&u.gr_val, const_str("x")), "puri-8"); in = *_str("sip:alice@atlanta.org;transport=udp;user=phone;maddr=1.2.3.4;gr"); ok(parse_uri(in.s, in.len, &u) == 0, "puri-9"); - ok(str_match(&u.user, _str("alice")), "puri-10"); - ok(str_match(&u.host, _str("atlanta.org")), "puri-11"); - ok(str_match(&u.transport, _str("transport=udp")), "puri-12"); - ok(str_match(&u.transport_val, _str("udp")), "puri-13"); - ok(str_match(&u.user_param, _str("user=phone")), "puri-14"); - ok(str_match(&u.user_param_val, _str("phone")), "puri-15"); - ok(str_match(&u.maddr, _str("maddr=1.2.3.4")), "puri-16"); - ok(str_match(&u.maddr_val, _str("1.2.3.4")), "puri-17"); - ok(str_match(&u.gr, _str("gr")), "puri-18"); - ok(str_match(&u.gr_val, _str("")), "puri-19"); + ok(str_match(&u.user, const_str("alice")), "puri-10"); + ok(str_match(&u.host, const_str("atlanta.org")), "puri-11"); + ok(str_match(&u.transport, const_str("transport=udp")), "puri-12"); + ok(str_match(&u.transport_val, const_str("udp")), "puri-13"); + ok(str_match(&u.user_param, const_str("user=phone")), "puri-14"); + ok(str_match(&u.user_param_val, const_str("phone")), "puri-15"); + ok(str_match(&u.maddr, const_str("maddr=1.2.3.4")), "puri-16"); + ok(str_match(&u.maddr_val, const_str("1.2.3.4")), "puri-17"); + ok(str_match(&u.gr, const_str("gr")), "puri-18"); + ok(str_match(&u.gr_val, const_str("")), "puri-19"); /* SIP PN (RFC 8599) URI param parsing tests */ /* pn-provider value is optional */ in = *_str("sip:alice@atlanta.org;pn-provider"); ok(parse_uri(in.s, in.len, &u) == 0, "puri-20"); - ok(str_match(&u.pn_provider, _str("pn-provider")), "puri-21"); - ok(str_match(&u.pn_provider_val, _str("")), "puri-22"); + ok(str_match(&u.pn_provider, const_str("pn-provider")), "puri-21"); + ok(str_match(&u.pn_provider_val, const_str("")), "puri-22"); ok(!u.pn_provider_val.s, "puri-22-NULL"); in = *_str("sip:alice@atlanta.org;pn-provider="); ok(parse_uri(in.s, in.len, &u) == 0, "puri-23"); - ok(str_match(&u.pn_provider, _str("pn-provider=")), "puri-24"); - ok(str_match(&u.pn_provider_val, _str("")), "puri-25"); + ok(str_match(&u.pn_provider, const_str("pn-provider=")), "puri-24"); + ok(str_match(&u.pn_provider_val, const_str("")), "puri-25"); ok(!u.pn_provider_val.s, "puri-25-NULL"); in = *_str("sip:alice@atlanta.org;pn-provider=x"); ok(parse_uri(in.s, in.len, &u) == 0, "puri-26"); - ok(str_match(&u.pn_provider, _str("pn-provider=x")), "puri-27"); - ok(str_match(&u.pn_provider_val, _str("x")), "puri-28"); + ok(str_match(&u.pn_provider, const_str("pn-provider=x")), "puri-27"); + ok(str_match(&u.pn_provider_val, const_str("x")), "puri-28"); /* pn-prid value is mandatory */ in = *_str("sip:alice@atlanta.org;pn-prid="); @@ -119,14 +119,14 @@ void test_parse_uri(void) in = *_str("sip:alice@atlanta.org;pn-provider=x;pn-prid=y;" "pn-param=z;pn-purr=t"); ok(parse_uri(in.s, in.len, &u) == 0, "puri-35"); - ok(str_match(&u.pn_provider, _str("pn-provider=x")), "puri-36"); - ok(str_match(&u.pn_provider_val, _str("x")), "puri-37"); - ok(str_match(&u.pn_prid, _str("pn-prid=y")), "puri-38"); - ok(str_match(&u.pn_prid_val, _str("y")), "puri-39"); - ok(str_match(&u.pn_param, _str("pn-param=z")), "puri-40"); - ok(str_match(&u.pn_param_val, _str("z")), "puri-41"); - ok(str_match(&u.pn_purr, _str("pn-purr=t")), "puri-42"); - ok(str_match(&u.pn_purr_val, _str("t")), "puri-43"); + ok(str_match(&u.pn_provider, const_str("pn-provider=x")), "puri-36"); + ok(str_match(&u.pn_provider_val, const_str("x")), "puri-37"); + ok(str_match(&u.pn_prid, const_str("pn-prid=y")), "puri-38"); + ok(str_match(&u.pn_prid_val, const_str("y")), "puri-39"); + ok(str_match(&u.pn_param, const_str("pn-param=z")), "puri-40"); + ok(str_match(&u.pn_param_val, const_str("z")), "puri-41"); + ok(str_match(&u.pn_purr, const_str("pn-purr=t")), "puri-42"); + ok(str_match(&u.pn_purr_val, const_str("t")), "puri-43"); } void test_parser(void)