From f0fdfd4f491ec8db96d9d398ce482d7d601575c6 Mon Sep 17 00:00:00 2001 From: Jakub Jelen Date: Wed, 10 Dec 2025 19:27:58 +0100 Subject: [PATCH] sftp: Reformat sftp_extensions_* API MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jakub Jelen Reviewed-by: Pavol Žáčik --- src/sftp.c | 65 ++++++++++++++++++++++++++++++------------------------ 1 file changed, 36 insertions(+), 29 deletions(-) diff --git a/src/sftp.c b/src/sftp.c index bf6a1f10..c406d41e 100644 --- a/src/sftp.c +++ b/src/sftp.c @@ -583,44 +583,51 @@ int sftp_init(sftp_session sftp) return 0; } -unsigned int sftp_extensions_get_count(sftp_session sftp) { - if (sftp == NULL || sftp->ext == NULL) { - return 0; - } +unsigned int sftp_extensions_get_count(sftp_session sftp) +{ + if (sftp == NULL || sftp->ext == NULL) { + return 0; + } - return sftp->ext->count; + return sftp->ext->count; } -const char *sftp_extensions_get_name(sftp_session sftp, unsigned int idx) { - if (sftp == NULL) - return NULL; - if (sftp->ext == NULL || sftp->ext->name == NULL) { - ssh_set_error_invalid(sftp->session); - return NULL; - } +const char *sftp_extensions_get_name(sftp_session sftp, unsigned int idx) +{ + if (sftp == NULL) { + return NULL; + } - if (idx > sftp->ext->count) { - ssh_set_error_invalid(sftp->session); - return NULL; - } + if (sftp->ext == NULL || sftp->ext->name == NULL) { + ssh_set_error_invalid(sftp->session); + return NULL; + } - return sftp->ext->name[idx]; + if (idx > sftp->ext->count) { + ssh_set_error_invalid(sftp->session); + return NULL; + } + + return sftp->ext->name[idx]; } -const char *sftp_extensions_get_data(sftp_session sftp, unsigned int idx) { - if (sftp == NULL) - return NULL; - if (sftp->ext == NULL || sftp->ext->name == NULL) { - ssh_set_error_invalid(sftp->session); - return NULL; - } +const char *sftp_extensions_get_data(sftp_session sftp, unsigned int idx) +{ + if (sftp == NULL) { + return NULL; + } - if (idx > sftp->ext->count) { - ssh_set_error_invalid(sftp->session); - return NULL; - } + if (sftp->ext == NULL || sftp->ext->name == NULL) { + ssh_set_error_invalid(sftp->session); + return NULL; + } - return sftp->ext->data[idx]; + if (idx > sftp->ext->count) { + ssh_set_error_invalid(sftp->session); + return NULL; + } + + return sftp->ext->data[idx]; } int