1
0
mirror of https://github.com/libssh2/libssh2.git synced 2025-07-29 13:01:14 +03:00

tidy-up: prefer #ifdef / #ifndef (formatting)

Closes #1532
This commit is contained in:
Viktor Szakats
2025-01-31 12:01:51 +01:00
parent 784446b6c5
commit 5cca650b1d
8 changed files with 15 additions and 15 deletions

View File

@ -30,7 +30,7 @@
#include <stdio.h>
#include <string.h>
#if defined(_MSC_VER)
#ifdef _MSC_VER
#define LIBSSH2_FILESIZE_MASK "I64u"
#else
#define LIBSSH2_FILESIZE_MASK "llu"

View File

@ -29,7 +29,7 @@
#include <stdio.h>
#if defined(_MSC_VER)
#ifdef _MSC_VER
#define LIBSSH2_FILESIZE_MASK "I64u"
#else
#define LIBSSH2_FILESIZE_MASK "llu"

View File

@ -347,13 +347,13 @@ int main(int argc, char *argv[])
libssh2_trace(session, LIBSSH2_TRACE_CONN);
/* Set X11 Callback */
#if defined(__clang__)
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wcast-function-type"
#endif
libssh2_session_callback_set2(session, LIBSSH2_CALLBACK_X11,
(libssh2_cb_generic *)x11_callback);
#if defined(__clang__)
#ifdef __clang__
#pragma clang diagnostic pop
#endif

View File

@ -141,7 +141,7 @@
#endif
/* Use local implementation when not available */
#if !defined(HAVE_SNPRINTF)
#ifndef HAVE_SNPRINTF
#undef snprintf
#define snprintf _libssh2_snprintf
#define LIBSSH2_SNPRINTF
@ -149,7 +149,7 @@ int _libssh2_snprintf(char *cp, size_t cp_max_len, const char *fmt, ...)
LIBSSH2_PRINTF(3, 4);
#endif
#if !defined(HAVE_GETTIMEOFDAY)
#ifndef HAVE_GETTIMEOFDAY
#define HAVE_GETTIMEOFDAY
#undef gettimeofday
#define gettimeofday _libssh2_gettimeofday
@ -159,7 +159,7 @@ int _libssh2_gettimeofday(struct timeval *tp, void *tzp);
#include <sys/time.h>
#endif
#if !defined(LIBSSH2_FALLTHROUGH)
#ifndef LIBSSH2_FALLTHROUGH
#if (defined(__GNUC__) && __GNUC__ >= 7) || \
(defined(__clang__) && __clang_major__ >= 10)
# define LIBSSH2_FALLTHROUGH() __attribute__((fallthrough))

View File

@ -48,7 +48,7 @@
#if !defined(__clang__) && __GNUC__ >= 10
#pragma GCC diagnostic ignored "-Warith-conversion"
#endif
#if defined(__clang__)
#ifdef __clang__
#pragma GCC diagnostic ignored "-Wsign-conversion"
#endif
/* mbedTLS (as of v3.5.1) has a duplicate function declaration

View File

@ -160,7 +160,7 @@ int _libssh2_hmac_update(libssh2_hmac_ctx *ctx,
return EVP_MAC_update(*ctx, data, datalen);
#elif defined(HAVE_OPAQUE_STRUCTS)
/* FIXME: upstream bug as of v5.7.0: datalen is int instead of size_t */
#if defined(LIBSSH2_WOLFSSL)
#ifdef LIBSSH2_WOLFSSL
return HMAC_Update(*ctx, data, (int)datalen);
#else /* !LIBSSH2_WOLFSSL */
return HMAC_Update(*ctx, data, datalen);
@ -452,7 +452,7 @@ _libssh2_rsa_sha2_verify(libssh2_rsa_ctx * rsactx,
else {
/* silence:
warning C4701: potentially uninitialized local variable 'nid_type' used */
#if defined(_MSC_VER)
#ifdef _MSC_VER
nid_type = 0;
#endif
ret = -1; /* unsupported digest */
@ -1293,7 +1293,7 @@ gen_publickey_from_rsa(LIBSSH2_SESSION *session, libssh2_rsa_ctx *rsa,
#else
const BIGNUM * e;
const BIGNUM * n;
#if defined(HAVE_OPAQUE_STRUCTS)
#ifdef HAVE_OPAQUE_STRUCTS
e = NULL;
n = NULL;

View File

@ -45,7 +45,7 @@
#include <stdlib.h> /* strtoll(), _strtoi64(), strtol() */
#if defined(HAVE_STRTOLL)
#ifdef HAVE_STRTOLL
#define scpsize_strtol strtoll
#elif defined(HAVE_STRTOI64)
#define scpsize_strtol _strtoi64

View File

@ -60,7 +60,7 @@
#include "channel.h"
#include "mac.h"
#if defined(_WIN32)
#ifdef _WIN32
#define libssh2_usec_t long
#elif defined(__APPLE__)
#define libssh2_usec_t suseconds_t
@ -489,7 +489,7 @@ libssh2_session_init_ex(LIBSSH2_ALLOC_FUNC((*my_alloc)),
* Set (or reset) a callback function
* Returns the prior address
*/
#if defined(__clang__)
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wcast-function-type"
#endif
@ -557,7 +557,7 @@ libssh2_session_callback_set2(LIBSSH2_SESSION *session, int cbtype,
return NULL;
}
#if defined(__clang__)
#ifdef __clang__
#pragma clang diagnostic pop
#endif