Commit f535f4f5 authored by Daniel Stenberg's avatar Daniel Stenberg
Browse files

buffer_size: make sure it always has the correct size

Removes the need for CURL_BUFSIZE
parent 7c312f84
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -870,7 +870,7 @@ struct Curl_easy *curl_easy_duphandle(struct Curl_easy *data)
   * the likeliness of us forgetting to init a buffer here in the future.
   */
  outcurl->set.buffer_size = data->set.buffer_size;
  outcurl->state.buffer = malloc(CURL_BUFSIZE(outcurl->set.buffer_size) + 1);
  outcurl->state.buffer = malloc(outcurl->set.buffer_size + 1);
  if(!outcurl->state.buffer)
    goto fail;

+1 −1
Original line number Diff line number Diff line
@@ -2824,7 +2824,7 @@ static CURLcode ftp_statemach_act(struct connectdata *conn)
    case FTP_PWD:
      if(ftpcode == 257) {
        char *ptr=&data->state.buffer[4];  /* start on the first letter */
        const size_t buf_size = CURL_BUFSIZE(data->set.buffer_size);
        const size_t buf_size = data->set.buffer_size;
        char *dir;
        char *store;

+1 −1
Original line number Diff line number Diff line
@@ -1416,7 +1416,7 @@ static CURLcode telnet_do(struct connectdata *conn, bool *done)

  /* Keep on listening and act on events */
  while(keepon) {
    const DWORD buf_size = (DWORD)CURL_BUFSIZE(data->set.buffer_size);
    const DWORD buf_size = (DWORD)data->set.buffer_size;
    waitret = WaitForMultipleObjects(obj_count, objs, FALSE, wait_timeout);
    switch(waitret) {
    case WAIT_TIMEOUT:
+1 −0
Original line number Diff line number Diff line
@@ -607,6 +607,7 @@ CURLcode Curl_init_userdefined(struct UserDefined *set)

  set->expect_100_timeout = 1000L; /* Wait for a second by default. */
  set->sep_headers = TRUE; /* separated header lists by default */
  set->buffer_size = BUFSIZE;

  Curl_http2_init_userset(set);
  return result;
+0 −1
Original line number Diff line number Diff line
@@ -206,7 +206,6 @@
#undef MAX_BUFSIZE
#define MAX_BUFSIZE CURL_MAX_READ_SIZE
#define MIN_BUFSIZE 1024
#define CURL_BUFSIZE(x) ((x)?(x):(BUFSIZE))

/* Initial size of the buffer to store headers in, it'll be enlarged in case
   of need. */