Skip to content

Commit

Permalink
styling
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobmealey committed Sep 2, 2023
1 parent c27b7e2 commit 8bccffb
Showing 1 changed file with 23 additions and 14 deletions.
37 changes: 23 additions & 14 deletions trurl.c
Original file line number Diff line number Diff line change
Expand Up @@ -265,18 +265,19 @@ int nqpairs; /* how many is stored */

static void trurl_cleanup_options(struct option *o)
{
if(!o) return;
if(o->url_list)
if(!o)
return;
if(o->url_list)
curl_slist_free_all(o->url_list);
if(o->set_list)
if(o->set_list)
curl_slist_free_all(o->set_list);
if(o->iter_list)
if(o->iter_list)
curl_slist_free_all(o->iter_list);
if(o->append_query)
if(o->append_query)
curl_slist_free_all(o->append_query);
if(o->trim_list)
if(o->trim_list)
curl_slist_free_all(o->trim_list);
if(o->append_path)
if(o->append_path)
curl_slist_free_all(o->append_path);
}

Expand Down Expand Up @@ -457,7 +458,8 @@ static int getarg(struct option *o,
if(o->qsep)
trurl_errorf(o, ERROR_FLAG, "only one --query-separator is supported");
if(strlen(arg) != 1)
trurl_errorf(o, ERROR_FLAG, "only single-letter query separators are supported");
trurl_errorf(o, ERROR_FLAG,
"only single-letter query separators are supported");
o->qsep = arg;
*usedarg = true;
}
Expand All @@ -470,7 +472,8 @@ static int getarg(struct option *o,
if(o->format)
trurl_errorf(o, ERROR_FLAG, "only one --get is supported");
if(o->jsonout)
trurl_errorf(o, ERROR_FLAG, "--get is mututally exclusive with --json");
trurl_errorf(o, ERROR_FLAG,
"--get is mututally exclusive with --json");
o->format = arg;
*usedarg = true;
}
Expand Down Expand Up @@ -720,7 +723,9 @@ static void get(struct option *o, CURLU *uh)
fputc('\n', stream);
}

static const struct var *setone(struct option *o, CURLU *uh, const char *setline)
static const struct var *setone(struct option *o,
CURLU *uh,
const char *setline)
{
char *ptr = strchr(setline, '=');
const struct var *v = NULL;
Expand All @@ -743,7 +748,8 @@ static const struct var *setone(struct option *o, CURLU *uh, const char *setline
found = true;
}
if(!found)
trurl_errorf(o, ERROR_SET, "unknown component: %.*s", (int)vlen, setline);
trurl_errorf(o, ERROR_SET,
"unknown component: %.*s", (int)vlen, setline);
}
else
trurl_errorf(o, ERROR_SET, "invalid --set syntax: %s", setline);
Expand All @@ -761,7 +767,8 @@ static unsigned int set(CURLU *uh,
v = setone(o, uh, setline);
if(v) {
if(mask & (1 << v->part))
trurl_errorf(o, ERROR_SET, "duplicate --set for component %s", v->name);
trurl_errorf(o, ERROR_SET,
"duplicate --set for component %s", v->name);
mask |= (1 << v->part);
}
}
Expand Down Expand Up @@ -1195,11 +1202,13 @@ static void singleurl(struct option *o,
}
if(iinfo->varmask & (1<<v->part)) {
curl_url_cleanup(uh);
trurl_errorf(o, ERROR_ITER, "duplicate component for iterate: %s", v->name);
trurl_errorf(o, ERROR_ITER,
"duplicate component for iterate: %s", v->name);
}
if(setmask & (1 << v->part)) {
curl_url_cleanup(uh);
trurl_errorf(o, ERROR_ITER, "duplicate --iterate and --set for component %s",
trurl_errorf(o, ERROR_ITER,
"duplicate --iterate and --set for component %s",
v->name);
}
}
Expand Down

0 comments on commit 8bccffb

Please sign in to comment.