xfree is not particularly helpful, remove it. From Thomas Adam.

This commit is contained in:
Nicholas Marriott
2012-07-10 11:53:01 +00:00
parent a3391692ad
commit df912e3540
73 changed files with 329 additions and 360 deletions

45
cmd.c
View File

@ -198,11 +198,9 @@ cmd_free_argv(int argc, char **argv)
if (argc == 0)
return;
for (i = 0; i < argc; i++) {
if (argv[i] != NULL)
xfree(argv[i]);
}
xfree(argv);
for (i = 0; i < argc; i++)
free(argv[i]);
free(argv);
}
struct cmd *
@ -291,9 +289,8 @@ cmd_exec(struct cmd *cmd, struct cmd_ctx *ctx)
void
cmd_free(struct cmd *cmd)
{
if (cmd->args != NULL)
args_free(cmd->args);
xfree(cmd);
args_free(cmd->args);
free(cmd);
}
size_t
@ -507,7 +504,7 @@ cmd_find_client(struct cmd_ctx *ctx, const char *arg)
if (c == NULL)
ctx->error(ctx, "client not found: %s", tmparg);
xfree(tmparg);
free(tmparg);
return (c);
}
@ -767,7 +764,7 @@ cmd_find_session(struct cmd_ctx *ctx, const char *arg, int prefer_unattached)
/* An empty session name is the current session. */
if (*tmparg == '\0') {
xfree(tmparg);
free(tmparg);
return (cmd_current_session(ctx, prefer_unattached));
}
@ -786,7 +783,7 @@ cmd_find_session(struct cmd_ctx *ctx, const char *arg, int prefer_unattached)
ctx->error(ctx, "session not found: %s", tmparg);
}
xfree(tmparg);
free(tmparg);
return (s);
}
@ -861,7 +858,7 @@ cmd_find_window(struct cmd_ctx *ctx, const char *arg, struct session **sp)
goto not_found;
if (sessptr != NULL)
xfree(sessptr);
free(sessptr);
return (wl);
no_colon:
@ -899,8 +896,7 @@ no_session:
ctx->error(ctx, "multiple sessions: %s", arg);
else
ctx->error(ctx, "session not found: %s", arg);
if (sessptr != NULL)
xfree(sessptr);
free(sessptr);
return (NULL);
not_found:
@ -908,8 +904,7 @@ not_found:
ctx->error(ctx, "multiple windows: %s", arg);
else
ctx->error(ctx, "window not found: %s", arg);
if (sessptr != NULL)
xfree(sessptr);
free(sessptr);
return (NULL);
}
@ -1000,8 +995,7 @@ cmd_find_index(struct cmd_ctx *ctx, const char *arg, struct session **sp)
} else if ((idx = cmd_lookup_index(s, winptr, &ambiguous)) == -1)
goto invalid_index;
if (sessptr != NULL)
xfree(sessptr);
free(sessptr);
return (idx);
no_colon:
@ -1040,8 +1034,7 @@ no_session:
ctx->error(ctx, "multiple sessions: %s", arg);
else
ctx->error(ctx, "session not found: %s", arg);
if (sessptr != NULL)
xfree(sessptr);
free(sessptr);
return (-2);
invalid_index:
@ -1049,8 +1042,7 @@ invalid_index:
goto not_found;
ctx->error(ctx, "invalid index: %s", arg);
if (sessptr != NULL)
xfree(sessptr);
free(sessptr);
return (-2);
not_found:
@ -1058,8 +1050,7 @@ not_found:
ctx->error(ctx, "multiple windows: %s", arg);
else
ctx->error(ctx, "window not found: %s", arg);
if (sessptr != NULL)
xfree(sessptr);
free(sessptr);
return (-2);
}
@ -1153,7 +1144,7 @@ cmd_find_pane(struct cmd_ctx *ctx,
goto lookup_string;
}
xfree(winptr);
free(winptr);
return (wl);
lookup_string:
@ -1163,7 +1154,7 @@ lookup_string:
goto error;
}
xfree(winptr);
free(winptr);
return (wl);
no_period:
@ -1189,7 +1180,7 @@ lookup_window:
return (wl);
error:
xfree(winptr);
free(winptr);
return (NULL);
}