1
0
mirror of https://github.com/libssh2/libssh2.git synced 2026-01-25 12:21:33 +03:00

tidy-up: parenthesis in macros

- delete superfluous ones.
- add missing ones.
  Did not cause an actual issue with the current use of these macros.

Closes #1773
This commit is contained in:
Viktor Szakats
2025-12-26 01:49:55 +01:00
parent 71804d9f8d
commit d97d8e3198
9 changed files with 40 additions and 40 deletions

View File

@@ -8,8 +8,8 @@
#ifdef _WIN32
#include <ws2tcpip.h> /* for socklen_t */
#define recv(s, b, l, f) recv((s), (b), (int)(l), (f))
#define send(s, b, l, f) send((s), (b), (int)(l), (f))
#define recv(s, b, l, f) recv(s, b, (int)(l), f)
#define send(s, b, l, f) send(s, b, (int)(l), f)
#endif
#ifdef HAVE_SYS_SOCKET_H

View File

@@ -9,7 +9,7 @@
#include <libssh2.h>
#ifdef _WIN32
#define write(f, b, c) write((f), (b), (unsigned int)(c))
#define write(f, b, c) write(f, b, (unsigned int)(c))
#endif
#ifdef HAVE_SYS_SOCKET_H

View File

@@ -14,7 +14,7 @@
#include <libssh2.h>
#ifdef _WIN32
#define write(f, b, c) write((f), (b), (unsigned int)(c))
#define write(f, b, c) write(f, b, (unsigned int)(c))
#endif
#ifdef HAVE_SYS_SOCKET_H

View File

@@ -15,7 +15,7 @@
#include <libssh2_sftp.h>
#ifdef _WIN32
#define write(f, b, c) write((f), (b), (unsigned int)(c))
#define write(f, b, c) write(f, b, (unsigned int)(c))
#endif
#ifdef HAVE_SYS_SOCKET_H

View File

@@ -15,7 +15,7 @@
#include <libssh2_sftp.h>
#ifdef _WIN32
#define write(f, b, c) write((f), (b), (unsigned int)(c))
#define write(f, b, c) write(f, b, (unsigned int)(c))
#endif
#ifdef HAVE_SYS_SOCKET_H

View File

@@ -15,7 +15,7 @@
#include <libssh2_sftp.h>
#ifdef _WIN32
#define write(f, b, c) write((f), (b), (unsigned int)(c))
#define write(f, b, c) write(f, b, (unsigned int)(c))
#endif
#ifdef HAVE_SYS_SOCKET_H

View File

@@ -8,8 +8,8 @@
#ifdef _WIN32
#include <ws2tcpip.h> /* for socklen_t */
#define recv(s, b, l, f) recv((s), (b), (int)(l), (f))
#define send(s, b, l, f) send((s), (b), (int)(l), (f))
#define recv(s, b, l, f) recv(s, b, (int)(l), f)
#define send(s, b, l, f) send(s, b, (int)(l), f)
#endif
#ifdef HAVE_SYS_SOCKET_H

View File

@@ -195,7 +195,7 @@ struct iovec {
#ifdef __OS400__
/* Force parameter type. */
#define send(s, b, l, f) send((s), (unsigned char *) (b), (l), (f))
#define send(s, b, l, f) send(s, (unsigned char *)(b), l, f)
#endif
#include "crypto.h"
@@ -229,63 +229,63 @@ struct iovec {
#define MAX_SHA_DIGEST_LEN SHA512_DIGEST_LENGTH
#define LIBSSH2_ALLOC(session, count) \
session->alloc((count), &(session)->abstract)
session->alloc(count, &(session)->abstract)
#define LIBSSH2_CALLOC(session, count) _libssh2_calloc(session, count)
#define LIBSSH2_REALLOC(session, ptr, count) \
((ptr) ? session->realloc((ptr), (count), &(session)->abstract) : \
session->alloc((count), &(session)->abstract))
((ptr) ? (session)->realloc(ptr, count, &(session)->abstract) : \
(session)->alloc(count, &(session)->abstract))
#define LIBSSH2_FREE(session, ptr) \
session->free((ptr), &(session)->abstract)
session->free(ptr, &(session)->abstract)
#define LIBSSH2_IGNORE(session, data, datalen) \
session->ssh_msg_ignore((session), (data), (int)(datalen), \
session->ssh_msg_ignore(session, data, (int)(datalen), \
&(session)->abstract)
#define LIBSSH2_DEBUG(session, always_display, message, message_len, \
language, language_len) \
session->ssh_msg_debug((session), (always_display), \
(message), (int)(message_len), \
(language), (int)(language_len), \
session->ssh_msg_debug(session, always_display, \
message, (int)(message_len), \
language, (int)(language_len), \
&(session)->abstract)
#define LIBSSH2_DISCONNECT(session, reason, message, message_len, \
language, language_len) \
session->ssh_msg_disconnect((session), (reason), \
(message), (int)(message_len), \
(language), (int)(language_len), \
session->ssh_msg_disconnect(session, reason, \
message, (int)(message_len), \
language, (int)(language_len), \
&(session)->abstract)
#define LIBSSH2_MACERROR(session, data, datalen) \
session->macerror((session), (data), (int)(datalen), &(session)->abstract)
session->macerror(session, data, (int)(datalen), &(session)->abstract)
#define LIBSSH2_X11_OPEN(channel, shost, sport) \
channel->session->x11(((channel)->session), (channel), \
(shost), (sport), (&(channel)->session->abstract))
channel->session->x11((channel)->session, channel, \
shost, sport, &(channel)->session->abstract)
#define LIBSSH2_AUTHAGENT(channel) \
channel->session->authagent(((channel)->session), (channel), \
(&(channel)->session->abstract))
channel->session->authagent((channel)->session, channel, \
&(channel)->session->abstract)
#define LIBSSH2_ADD_IDENTITIES(session, buffer, agentPath) \
session->addLocalIdentities((session), (buffer), \
(agentPath), (&(session->abstract)))
session->addLocalIdentities(session, buffer, \
agentPath, &(session)->abstract)
#define LIBSSH2_AUTHAGENT_SIGN(session, blob, blen, \
data, dlen, sig, sigLen, \
agentPath) \
session->agentSignCallback((session), (blob), (blen), \
(data), (dlen), (sig), (sigLen), \
(agentPath), (&(session->abstract)))
session->agentSignCallback(session, blob, blen, \
data, dlen, sig, sigLen, \
agentPath, &(session)->abstract)
#define LIBSSH2_CHANNEL_CLOSE(session, channel) \
channel->close_cb((session), &(session)->abstract, \
(channel), &(channel)->abstract)
channel->close_cb(session, &(session)->abstract, \
channel, &(channel)->abstract)
#define LIBSSH2_SEND_FD(session, fd, buffer, length, flags) \
(session->send)(fd, buffer, length, flags, &session->abstract)
((session)->send)(fd, buffer, length, flags, &(session)->abstract)
#define LIBSSH2_RECV_FD(session, fd, buffer, length, flags) \
(session->recv)(fd, buffer, length, flags, &session->abstract)
((session)->recv)(fd, buffer, length, flags, &(session)->abstract)
#define LIBSSH2_SEND(session, buffer, length, flags) \
LIBSSH2_SEND_FD(session, session->socket_fd, buffer, length, flags)
LIBSSH2_SEND_FD(session, (session)->socket_fd, buffer, length, flags)
#define LIBSSH2_RECV(session, buffer, length, flags) \
LIBSSH2_RECV_FD(session, session->socket_fd, buffer, length, flags)
LIBSSH2_RECV_FD(session, (session)->socket_fd, buffer, length, flags)
typedef struct _LIBSSH2_KEX_METHOD LIBSSH2_KEX_METHOD;
typedef struct _LIBSSH2_HOSTKEY_METHOD LIBSSH2_HOSTKEY_METHOD;
@@ -1258,7 +1258,7 @@ void _libssh2_init_if_needed(void);
/* Utility function for certificate auth */
size_t plain_method(char *method, size_t method_len);
#define ARRAY_SIZE(a) (sizeof ((a)) / sizeof ((a)[0]))
#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
/* define to output the libssh2_int64_t type in a *printf() */
#if defined(__MINGW32__) || (defined(_MSC_VER) && (_MSC_VER >= 1800))

View File

@@ -50,8 +50,8 @@
#ifdef _WIN32
/* Force parameter type. */
#define libssh2_recv(s, b, l, f) recv((s), (b), (int)(l), (f))
#define libssh2_send(s, b, l, f) send((s), (b), (int)(l), (f))
#define libssh2_recv(s, b, l, f) recv(s, b, (int)(l), f)
#define libssh2_send(s, b, l, f) send(s, b, (int)(l), f)
#else
#define libssh2_recv recv
#define libssh2_send send