Changeset 14619


Ignore:
Timestamp:
Dec 13, 2015, 10:23:22 AM (5 years ago)
Author:
mikedld
Message:

Optionally return result length from evbuffer_free_to_str()

Location:
trunk
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/announcer-http.c

    r14521 r14619  
    118118    }
    119119
    120     return evbuffer_free_to_str (buf);
     120    return evbuffer_free_to_str (buf, NULL);
    121121}
    122122
     
    448448    }
    449449
    450     return evbuffer_free_to_str (buf);
     450    return evbuffer_free_to_str (buf, NULL);
    451451}
    452452
  • trunk/libtransmission/announcer.c

    r14525 r14619  
    768768        }
    769769
    770         message = evbuffer_free_to_str (buf);
     770        message = evbuffer_free_to_str (buf, NULL);
    771771        tr_logAddDeep (__FILE__, __LINE__, name, "announce queue is %s", message);
    772772        tr_free (message);
  • trunk/libtransmission/log.c

    r14548 r14619  
    195195      evbuffer_add_printf (buf, " (%s:%d)", base, line);
    196196      /* FIXME (libevent2) ifdef this out for nonwindows platforms */
    197       message = evbuffer_free_to_str (buf);
     197      message = evbuffer_free_to_str (buf, NULL);
    198198      OutputDebugStringA (message);
    199199      OutputDebugStringA (TR_NATIVE_EOL_STR);
  • trunk/libtransmission/peer-msgs.c

    r14613 r14619  
    302302      evbuffer_add_printf (buf, " (%s:%d)", base, line);
    303303
    304       message = evbuffer_free_to_str (buf);
     304      message = evbuffer_free_to_str (buf, NULL);
    305305      tr_sys_file_write_line (fp, message, NULL);
    306306
  • trunk/libtransmission/torrent-magnet.c

    r14532 r14619  
    407407    }
    408408
    409   return evbuffer_free_to_str (s);
    410 }
     409  return evbuffer_free_to_str (s, NULL);
     410}
  • trunk/libtransmission/utils.c

    r14613 r14619  
    350350
    351351char*
    352 evbuffer_free_to_str (struct evbuffer * buf)
     352evbuffer_free_to_str (struct evbuffer * buf,
     353                      size_t          * result_len)
    353354{
    354355  const size_t n = evbuffer_get_length (buf);
     
    357358  evbuffer_free (buf);
    358359  ret[n] = '\0';
     360  if (result_len != NULL)
     361    *result_len = n;
    359362  return ret;
    360363}
     
    427430  struct evbuffer * buf = evbuffer_new ();
    428431  evbuffer_add_vprintf (buf, fmt, args);
    429   return evbuffer_free_to_str (buf);
     432  return evbuffer_free_to_str (buf, NULL);
    430433}
    431434
     
    984987{
    985988  const char * end;
    986   const char zero = '\0';
    987989  struct evbuffer * buf = evbuffer_new ();
    988990
     
    9981000
    9991001  evbuffer_add (buf, in, inlen);
    1000   evbuffer_add (buf, &zero, 1);
    1001   return evbuffer_free_to_str (buf);
     1002  return evbuffer_free_to_str (buf, NULL);
    10021003}
    10031004
  • trunk/libtransmission/utils.h

    r14592 r14619  
    298298int tr_strcmp0 (const char * str1, const char * str2);
    299299
    300 char* evbuffer_free_to_str (struct evbuffer * buf);
     300char* evbuffer_free_to_str (struct evbuffer * buf,
     301                            size_t          * result_len);
    301302
    302303/** @brief similar to bsearch () but returns the index of the lower bound */
  • trunk/libtransmission/variant.c

    r14577 r14619  
    12031203{
    12041204  struct evbuffer * buf = tr_variantToBuf (v, fmt);
    1205   const size_t n = evbuffer_get_length (buf);
    1206   char * ret = evbuffer_free_to_str (buf);
     1205  size_t n;
     1206  char * ret = evbuffer_free_to_str (buf, &n);
    12071207  if (len != NULL)
    12081208    *len = (int) n;
  • trunk/libtransmission/webseed.c

    r14550 r14619  
    495495
    496496      if (!urls[file_index])
    497         urls[file_index] = evbuffer_free_to_str (make_url (t->webseed, file));
     497        urls[file_index] = evbuffer_free_to_str (make_url (t->webseed, file), NULL);
    498498
    499499      tr_snprintf (range, sizeof range, "%"PRIu64"-%"PRIu64,
  • trunk/utils/edit.c

    r14615 r14619  
    178178  evbuffer_add (buf, str, strlen (str));
    179179
    180   return evbuffer_free_to_str (buf);
     180  return evbuffer_free_to_str (buf, NULL);
    181181}
    182182
Note: See TracChangeset for help on using the changeset viewer.