summaryrefslogtreecommitdiffstats
path: root/cmd.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@openbsd.org>2012-07-10 11:53:01 +0000
committerNicholas Marriott <nicm@openbsd.org>2012-07-10 11:53:01 +0000
commitdf912e3540968a2a0b266e523ecc08bb2dc0ca20 (patch)
treec2c59d025e08aab048b251d1711ed655cdf115f6 /cmd.c
parenta3391692ad5800ca034bbbdcd803924fc4e392ee (diff)
xfree is not particularly helpful, remove it. From Thomas Adam.
Diffstat (limited to 'cmd.c')
-rw-r--r--cmd.c45
1 files changed, 18 insertions, 27 deletions
diff --git a/cmd.c b/cmd.c
index 5f97a854..eb2fd75c 100644
--- a/cmd.c
+++ b/cmd.c
@@ -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);
}