lib: save a bit of space with some structure packing

- Reorder some internal struct members so that less padding is used.

This is an attempt at saving a bit of space by packing some structs
(using pahole to find the holes) where it might make sense to do
so without losing readability.

I.e., I tried to avoid separating fields that seem grouped
together (like the cwd... fields in struct ftp_conn for instance).
Also abstained from touching fields behind conditional macros as
that quickly can get complicated.

Closes https://github.com/curl/curl/pull/6483
This commit is contained in:
Erik Olsson 2021-01-16 22:17:51 +01:00 committed by Jay Satiro
parent 46f4736356
commit 0a5827571f
12 changed files with 31 additions and 33 deletions

View file

@ -123,6 +123,8 @@ struct ssh_conn {
char *rsa_pub; /* path name */
char *rsa; /* path name */
bool authed; /* the connection has been authenticated fine */
bool acceptfail; /* used by the SFTP_QUOTE (continue if
quote command fails) */
sshstate state; /* always use ssh.c:state() to change state! */
sshstate nextstate; /* the state to goto after stopping */
CURLcode actualcode; /* the actual error code */
@ -130,8 +132,6 @@ struct ssh_conn {
char *quote_path1; /* two generic pointers for the QUOTE stuff */
char *quote_path2;
bool acceptfail; /* used by the SFTP_QUOTE (continue if
quote command fails) */
char *homedir; /* when doing SFTP we figure out home dir in the
connect phase */
char *readdir_line;
@ -140,9 +140,8 @@ struct ssh_conn {
int secondCreateDirs; /* counter use by the code to see if the
second attempt has been made to change
to/create a directory */
char *slash_pos; /* used by the SFTP_CREATE_DIRS state */
int orig_waitfor; /* default READ/WRITE bits wait for */
char *slash_pos; /* used by the SFTP_CREATE_DIRS state */
#if defined(USE_LIBSSH)
char *readdir_linkPath;