Commit acd1b69c authored by Daniel Salzman's avatar Daniel Salzman

Various fixes (cppcheck)

parent 0c723d28
......@@ -138,9 +138,8 @@ int zone_load_post(conf_t *conf, zone_contents_t *contents, zone_t *zone,
return KNOT_EINVAL;
}
int ret = KNOT_EOK;
changeset_t change;
ret = changeset_init(&change, zone->name);
int ret = changeset_init(&change, zone->name);
if (ret != KNOT_EOK) {
return ret;
}
......
......@@ -34,7 +34,6 @@ static int format_item(
}
// Format key part.
size_t total = 0;
int ret = snprintf(out, out_len, "%s%s%s%s",
first_value ? prefix : "",
first_value ? item->name + 1 : "",
......@@ -44,8 +43,7 @@ static int format_item(
if (ret < 0 || ret >= out_len) {
return KNOT_ESPACE;
}
total += ret;
out += ret;
out += ret;
out_len -= ret;
// Finish if group.
......@@ -59,8 +57,7 @@ static int format_item(
if (ret != KNOT_EOK) {
return ret;
}
total += aux_len;
out += aux_len;
out += aux_len;
out_len -= aux_len;
// Format data end.
......
This diff is collapsed.
......@@ -119,7 +119,7 @@ extern int cf_debug;
typedef union YYSTYPE YYSTYPE;
union YYSTYPE
{
#line 302 "cf-parse.y" /* yacc.c:1909 */
#line 301 "cf-parse.y" /* yacc.c:1909 */
struct {
char *t;
......
......@@ -48,13 +48,12 @@ volatile int parser_ret = 0;
static void cf_print_error(void *scanner, const char *prefix, const char *msg)
{
conf_extra_t *extra = NULL;
int lineno = -1;
char *filename = "";
conf_include_t *inc = NULL;
if (scanner) {
extra = cf_get_extra(scanner);
conf_extra_t *extra = cf_get_extra(scanner);
lineno = cf_get_lineno(scanner);
inc = conf_includes_top(extra->includes);
}
......@@ -63,8 +62,8 @@ static void cf_print_error(void *scanner, const char *prefix, const char *msg)
filename = inc->filename;
}
printf("%s: %s (file '%s', line %d)\n",
prefix, msg, filename, lineno);
printf("%s: %s (file '%s', line %d)\n", prefix, msg, filename, lineno);
fflush(stdout);
}
......
......@@ -106,7 +106,7 @@ int main(int argc, char *argv[])
ret = yp_parse(yp);
ok(ret == KNOT_EOK, "parse %i. key0 with value", i);
ok(yp->key_len == 1 && yp->key[0] == 'b' &&
yp->data_len == 1 && yp->key[0] == 'b' &&
yp->data_len == 1 && yp->data[0] == 'b' &&
yp->event == YP_EKEY0 && yp->line_count == line + i,
"compare %i. key0 with value", i);
}
......@@ -116,7 +116,7 @@ int main(int argc, char *argv[])
ret = yp_parse(yp);
ok(ret == KNOT_EOK, "parse %i. key1 with value", i);
ok(yp->key_len == 1 && yp->key[0] == 'f' &&
yp->data_len == 1 && yp->key[0] == 'f' &&
yp->data_len == 1 && yp->data[0] == 'f' &&
yp->event == YP_EKEY1 && yp->line_count == line + i,
"compare %i. key1 with value", i);
}
......@@ -143,7 +143,7 @@ int main(int argc, char *argv[])
ret = yp_parse(yp);
ok(ret == KNOT_EOK, "parse %i. id", i);
ok(yp->key_len == 1 && yp->key[0] == 'd' &&
yp->data_len == 1 && yp->key[0] == 'd' &&
yp->data_len == 1 && yp->data[0] == 'd' &&
yp->event == YP_EID && yp->line_count == line + i,
"compare %i. id", i);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment