/* If we're doing a resumed transfer, we need to setup our stuff properly.  */
static CURLcode setup_range(struct Curl_easy *data)
/* If we're doing a resumed transfer, we need to setup our stuff properly.  */
static CURLcode setup_range(struct Curl_easy *data)
{
  struct UrlState *s = &data->state;
  s->resume_from = data->set.set_resume_from;
  if(s->resume_from || data->set.str[STRING_SET_RANGE]) {
    if(s->rangestringalloc)
      free(s->range);
    if(s->resume_from)
      s->range = aprintf("%" CURL_FORMAT_CURL_OFF_T "-", s->resume_from);
    else
      s->range = strdup(data->set.str[STRING_SET_RANGE]);
    s->rangestringalloc = (s->range) ? TRUE : FALSE;
    if(!s->range)
      return CURLE_OUT_OF_MEMORY;
    s->use_range = TRUE;
  }
  else
    s->use_range = FALSE;
  return CURLE_OK;
}