aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2013-08-14 22:28:32 +0200
committerDaniel Stenberg <daniel@haxx.se>2013-08-14 22:41:30 +0200
commitd5e2d0b6bfcf6b9961d4aaebb4b9687818d9f652 (patch)
treeba38f86a11aa197afe192151ded5c39a460e5827 /lib
parentf34b5fb4d8f525a99d2c402829a58336c73c19c2 (diff)
ftp: convert state names to a global array
... just to make them easier to print in debug ouputs while debugging. They are still within #ifdef [debugbuild].
Diffstat (limited to 'lib')
-rw-r--r--lib/ftp.c84
1 files changed, 43 insertions, 41 deletions
diff --git a/lib/ftp.c b/lib/ftp.c
index c4c974e9b..3f725fb21 100644
--- a/lib/ftp.c
+++ b/lib/ftp.c
@@ -775,6 +775,47 @@ CURLcode Curl_GetFTPResponse(ssize_t *nreadp, /* return number of bytes read */
return result;
}
+#if defined(DEBUGBUILD) && !defined(CURL_DISABLE_VERBOSE_STRINGS)
+ /* for debug purposes */
+static const char * const ftp_state_names[]={
+ "STOP",
+ "WAIT220",
+ "AUTH",
+ "USER",
+ "PASS",
+ "ACCT",
+ "PBSZ",
+ "PROT",
+ "CCC",
+ "PWD",
+ "SYST",
+ "NAMEFMT",
+ "QUOTE",
+ "RETR_PREQUOTE",
+ "STOR_PREQUOTE",
+ "POSTQUOTE",
+ "CWD",
+ "MKD",
+ "MDTM",
+ "TYPE",
+ "LIST_TYPE",
+ "RETR_TYPE",
+ "STOR_TYPE",
+ "SIZE",
+ "RETR_SIZE",
+ "STOR_SIZE",
+ "REST",
+ "RETR_REST",
+ "PORT",
+ "PRET",
+ "PASV",
+ "LIST",
+ "RETR",
+ "STOR",
+ "QUIT"
+};
+#endif
+
/* This is the ONLY way to change FTP state! */
static void _state(struct connectdata *conn,
ftpstate newstate
@@ -783,51 +824,12 @@ static void _state(struct connectdata *conn,
#endif
)
{
-#if defined(DEBUGBUILD) && !defined(CURL_DISABLE_VERBOSE_STRINGS)
- /* for debug purposes */
- static const char * const names[]={
- "STOP",
- "WAIT220",
- "AUTH",
- "USER",
- "PASS",
- "ACCT",
- "PBSZ",
- "PROT",
- "CCC",
- "PWD",
- "SYST",
- "NAMEFMT",
- "QUOTE",
- "RETR_PREQUOTE",
- "STOR_PREQUOTE",
- "POSTQUOTE",
- "CWD",
- "MKD",
- "MDTM",
- "TYPE",
- "LIST_TYPE",
- "RETR_TYPE",
- "STOR_TYPE",
- "SIZE",
- "RETR_SIZE",
- "STOR_SIZE",
- "REST",
- "RETR_REST",
- "PORT",
- "PRET",
- "PASV",
- "LIST",
- "RETR",
- "STOR",
- "QUIT"
- };
-#endif
struct ftp_conn *ftpc = &conn->proto.ftpc;
#if defined(DEBUGBUILD) && !defined(CURL_DISABLE_VERBOSE_STRINGS)
if(ftpc->state != newstate)
infof(conn->data, "FTP %p (line %d) state change from %s to %s\n",
- (void *)ftpc, lineno, names[ftpc->state], names[newstate]);
+ (void *)ftpc, lineno, ftp_state_names[ftpc->state],
+ ftp_state_names[newstate]);
#endif
ftpc->state = newstate;
}