[pulseaudio-commits] r2348 - /branches/coling/airtunes/src/modules/rtp/headerlist.c

svnmailer-noreply at 0pointer.de svnmailer-noreply at 0pointer.de
Fri May 2 02:47:10 PDT 2008


Author: coling
Date: Fri May  2 11:47:09 2008
New Revision: 2348

URL: http://0pointer.de/cgi-bin/viewcvs.cgi?rev=2348&root=pulseaudio&view=rev
Log:
Use pa_sprintf_malloc to do simple concatenation rather than using the higher overhead of pa_strbuf

Modified:
    branches/coling/airtunes/src/modules/rtp/headerlist.c

Modified: branches/coling/airtunes/src/modules/rtp/headerlist.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/coling/airtunes/src/modules/rtp/headerlist.c?rev=2348&root=pulseaudio&r1=2347&r2=2348&view=diff
==============================================================================
--- branches/coling/airtunes/src/modules/rtp/headerlist.c (original)
+++ branches/coling/airtunes/src/modules/rtp/headerlist.c Fri May  2 11:47:09 2008
@@ -92,22 +92,20 @@
 int pa_headerlist_putsappend(pa_headerlist *p, const char *key, const char *value) {
     struct header *hdr;
     pa_bool_t add = FALSE;
-    pa_strbuf *buf;
 
     pa_assert(p);
     pa_assert(key);
 
-    buf = pa_strbuf_new();
     if (!(hdr = pa_hashmap_get(MAKE_HASHMAP(p), key))) {
         hdr = pa_xnew(struct header, 1);
         hdr->key = pa_xstrdup(key);
+        hdr->value = pa_xstrdup(value);
         add = TRUE;
     } else {
-        pa_strbuf_puts(buf, hdr->value);
+        void *newval = (void*)pa_sprintf_malloc("%s%s", (char*)hdr->value, value);
         pa_xfree(hdr->value);
+        hdr->value = newval;
     }
-    pa_strbuf_puts(buf, value);
-    hdr->value = pa_strbuf_tostring_free(buf);
     hdr->nbytes = strlen(hdr->value)+1;
 
     if (add)




More information about the pulseaudio-commits mailing list