diff options
author | 2012-07-10 11:53:01 +0000 | |
---|---|---|
committer | 2012-07-10 11:53:01 +0000 | |
commit | 7d053cf95f3066c6e73307ead04fc57226a3af39 (patch) | |
tree | efeaa09d389b020f6bce2de45058037a32cbbf0e /usr.bin/tmux/cmd.c | |
parent | Instead of <arpa/inet.h> pulling in <netinet/in.h>, just copy in the (diff) | |
download | wireguard-openbsd-7d053cf95f3066c6e73307ead04fc57226a3af39.tar.xz wireguard-openbsd-7d053cf95f3066c6e73307ead04fc57226a3af39.zip |
xfree is not particularly helpful, remove it. From Thomas Adam.
Diffstat (limited to 'usr.bin/tmux/cmd.c')
-rw-r--r-- | usr.bin/tmux/cmd.c | 47 |
1 files changed, 19 insertions, 28 deletions
diff --git a/usr.bin/tmux/cmd.c b/usr.bin/tmux/cmd.c index e3b89eb1d55..1316b30c894 100644 --- a/usr.bin/tmux/cmd.c +++ b/usr.bin/tmux/cmd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd.c,v 1.67 2012/07/08 16:04:38 nicm Exp $ */ +/* $OpenBSD: cmd.c,v 1.68 2012/07/10 11:53:01 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -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); } |