Skip to content

Commit 8033b05

Browse files
committed
ext/ftp: Remove output field of ftpbuf_t struct
It was only used once, and removing it reduces the size of a userland FTP object by 4096 bytes
1 parent 1dd788a commit 8033b05

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

ext/ftp/ftp.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1181,7 +1181,7 @@ bool ftp_site(ftpbuf_t *ftp, const char *cmd, const size_t cmd_len)
11811181
static bool ftp_putcmd(ftpbuf_t *ftp, const char *cmd, const size_t cmd_len, const char *args, const size_t args_len)
11821182
{
11831183
int size;
1184-
char *data;
1184+
char data[FTP_BUFSIZE];
11851185

11861186
if (strpbrk(cmd, "\r\n")) {
11871187
return false;
@@ -1195,17 +1195,15 @@ static bool ftp_putcmd(ftpbuf_t *ftp, const char *cmd, const size_t cmd_len, con
11951195
if (strpbrk(args, "\r\n")) {
11961196
return 0;
11971197
}
1198-
size = slprintf(ftp->outbuf, sizeof(ftp->outbuf), "%s %s\r\n", cmd, args);
1198+
size = slprintf(data, sizeof(data), "%s %s\r\n", cmd, args);
11991199
} else {
12001200
/* "cmd\r\n\0" */
12011201
if (cmd_len + 3 > FTP_BUFSIZE) {
12021202
return false;
12031203
}
1204-
size = slprintf(ftp->outbuf, sizeof(ftp->outbuf), "%s\r\n", cmd);
1204+
size = slprintf(data, sizeof(data), "%s\r\n", cmd);
12051205
}
12061206

1207-
data = ftp->outbuf;
1208-
12091207
/* Clear the inbuf and extra-lines buffer */
12101208
ftp->inbuf[0] = '\0';
12111209
ftp->extra = NULL;

ext/ftp/ftp.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ typedef struct ftpbuf
6060
char inbuf[FTP_BUFSIZE]; /* last response text */
6161
char *extra; /* extra characters */
6262
int extralen; /* number of extra chars */
63-
char outbuf[FTP_BUFSIZE]; /* command output buffer */
6463
char *pwd; /* cached pwd */
6564
char *syst; /* cached system type */
6665
ftptype_t type; /* current transfer type */

0 commit comments

Comments
 (0)