<p>Sean Bright has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/8213">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">res_pjsip_header_funcs: Various cleanups<br><br> * Prefer strcasecmp() over stricmp()<br> * Use a list with no lock since we never actually lock<br> * Minor cleanups to error messages<br><br>Change-Id: I8446f44795ee8f3072e1c1f9193c6912dfc0c42b<br>---<br>M res/res_pjsip_header_funcs.c<br>1 file changed, 10 insertions(+), 17 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/13/8213/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/res/res_pjsip_header_funcs.c b/res/res_pjsip_header_funcs.c<br>index 5cb4a5f..d35dd91 100644<br>--- a/res/res_pjsip_header_funcs.c<br>+++ b/res/res_pjsip_header_funcs.c<br>@@ -146,18 +146,11 @@<br>        pjsip_hdr *hdr;<br>       AST_LIST_ENTRY(hdr_list_entry) nextptr;<br> };<br>-AST_LIST_HEAD(hdr_list, hdr_list_entry);<br>-<br>-/*! \brief Destructor for hdr_list */<br>-static void hdr_list_destroy(void *obj)<br>-{<br>-     AST_LIST_HEAD_DESTROY((struct hdr_list *) obj);<br>-}<br>+AST_LIST_HEAD_NOLOCK(hdr_list, hdr_list_entry);<br> <br> /*! \brief Datastore for saving headers */<br> static const struct ast_datastore_info header_datastore = {<br>   .type = "header_datastore",<br>-        .destroy = hdr_list_destroy,<br> };<br> <br> /*! \brief Data structure used for ast_sip_push_task_synchronous  */<br>@@ -215,7 +208,7 @@<br>                      ast_log(AST_LOG_ERROR, "Unable to create datastore for header functions.\n");<br>                       return 0;<br>             }<br>-            AST_LIST_HEAD_INIT((struct hdr_list *) datastore->data);<br>+          AST_LIST_HEAD_INIT_NOLOCK((struct hdr_list *) datastore->data);<br>    }<br>     insert_headers(pool, (struct hdr_list *) datastore->data, rdata->msg_info.msg);<br> <br>@@ -340,7 +333,7 @@<br>                         ast_log(AST_LOG_ERROR, "Unable to create datastore for header functions.\n");<br>                       return -1;<br>            }<br>-            AST_LIST_HEAD_INIT((struct hdr_list *) datastore->data);<br>+          AST_LIST_HEAD_INIT_NOLOCK((struct hdr_list *) datastore->data);<br>    }<br> <br>  ast_debug(1, "Adding header %s with value %s\n", data->header_name,<br>@@ -486,15 +479,15 @@<br>       header_data.buf = buf;<br>        header_data.len = len;<br> <br>-    if (stricmp(args.action, "read") == 0) {<br>+   if (!strcasecmp(args.action, "read")) {<br>             return ast_sip_push_task_synchronous(channel->session->serializer, read_header,<br>                                                                                          &header_data);<br>-  } else if (stricmp(args.action, "remove") == 0) {<br>+  } else if (!strcasecmp(args.action, "remove")) {<br>            return ast_sip_push_task_synchronous(channel->session->serializer, remove_header,<br>                                                                                        &header_data);<br>   } else {<br>              ast_log(AST_LOG_ERROR,<br>-                               "Unknown action \'%s\' is not valid,  Must be \'read\' or \'remove\'.\n",<br>+                          "Unknown action \'%s\' is not valid, must be \'read\' or \'remove\'.\n",<br>                            args.action);<br>                 return -1;<br>    }<br>@@ -545,18 +538,18 @@<br>      header_data.buf = NULL;<br>       header_data.len = 0;<br> <br>-      if (stricmp(args.action, "add") == 0) {<br>+    if (!strcasecmp(args.action, "add")) {<br>              return ast_sip_push_task_synchronous(channel->session->serializer, add_header,<br>                                                                                   &header_data);<br>-  } else if (stricmp(args.action, "update") == 0) {<br>+  } else if (!strcasecmp(args.action, "update")) {<br>            return ast_sip_push_task_synchronous(channel->session->serializer, update_header,<br>                                                                                        &header_data);<br>-  } else if (stricmp(args.action, "remove") == 0) {<br>+  } else if (!strcasecmp(args.action, "remove")) {<br>            return ast_sip_push_task_synchronous(channel->session->serializer, remove_header,<br>                                                                                        &header_data);<br>   } else {<br>              ast_log(AST_LOG_ERROR,<br>-                               "Unknown action \'%s\' is not valid,  Must be \'add\', \'update\', or \'remove\'.\n",<br>+                              "Unknown action \'%s\' is not valid, must be \'add\', \'update\', or \'remove\'.\n",<br>                                args.action);<br>                 return -1;<br>    }<br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/8213">change 8213</a>. To unsubscribe, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/8213"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 13 </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: I8446f44795ee8f3072e1c1f9193c6912dfc0c42b </div>
<div style="display:none"> Gerrit-Change-Number: 8213 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Sean Bright <sean.bright@gmail.com> </div>