This change moves the macros to tcpdump-stdinc.h to make sure these are
available without interface.h. It also dismisses two redundant macros
MIN() and SMBMIN(). It is intended to fix the following Solaris compile
error:
Undefined first referenced
symbol in file
MIN print-zeromq.o
#define PT_PGM_ZMTP1 15 /* ZMTP/1.0 inside PGM (native or UDP-encapsulated) */
#define PT_LMP 16 /* Link Management Protocol */
#define PT_PGM_ZMTP1 15 /* ZMTP/1.0 inside PGM (native or UDP-encapsulated) */
#define PT_LMP 16 /* Link Management Protocol */
-#ifndef min
-#define min(a,b) ((a)>(b)?(b):(a))
-#endif
-#ifndef max
-#define max(a,b) ((b)>(a)?(b):(a))
-#endif
-
#define ESRC(ep) ((ep)->ether_shost)
#define EDST(ep) ((ep)->ether_dhost)
#define ESRC(ep) ((ep)->ether_shost)
#define EDST(ep) ((ep)->ether_dhost)
-#ifndef MIN
-#define MIN(a,b) ((a)<(b)?(a):(b))
-#endif
-
extern char *program_name; /* used to generate self-identifying messages */
extern int32_t thiszone; /* seconds offset from gmt to local time */
extern char *program_name; /* used to generate self-identifying messages */
extern int32_t thiszone; /* seconds offset from gmt to local time */
- smb_fdata(words + 1, f1, SMBMIN(words + 1 + 2 * words[0], maxbuf),
+ smb_fdata(words + 1, f1, min(words + 1 + 2 * words[0], maxbuf),
unicodestr);
TCHECK2(*data1, 2);
unicodestr);
TCHECK2(*data1, 2);
- smb_fdata(param, f3, SMBMIN(param + paramlen, maxbuf), unicodestr);
+ smb_fdata(param, f3, min(param + paramlen, maxbuf), unicodestr);
- smb_fdata(data, f4, SMBMIN(data + datalen, maxbuf), unicodestr);
+ smb_fdata(data, f4, min(data + datalen, maxbuf), unicodestr);
- smb_fdata(words + 1, f1, SMBMIN(words + 1 + wct * 2, maxbuf),
+ smb_fdata(words + 1, f1, min(words + 1 + wct * 2, maxbuf),
- print_data(words + 1, SMBMIN(wct * 2, PTR_DIFF(maxbuf, words + 1)));
+ print_data(words + 1, min(wct * 2, PTR_DIFF(maxbuf, words + 1)));
TCHECK2(*data, 2);
bcc = EXTRACT_LE_16BITS(data);
printf("smb_bcc=%u\n", bcc);
if (bcc > 0) {
if (f2)
TCHECK2(*data, 2);
bcc = EXTRACT_LE_16BITS(data);
printf("smb_bcc=%u\n", bcc);
if (bcc > 0) {
if (f2)
- smb_fdata(data + 2, f2, SMBMIN(data + 2 + EXTRACT_LE_16BITS(data),
+ smb_fdata(data + 2, f2, min(data + 2 + EXTRACT_LE_16BITS(data),
maxbuf), unicodestr);
else
maxbuf), unicodestr);
else
- print_data(data + 2, SMBMIN(EXTRACT_LE_16BITS(data), PTR_DIFF(maxbuf, data + 2)));
+ print_data(data + 2, min(EXTRACT_LE_16BITS(data), PTR_DIFF(maxbuf, data + 2)));
- smb_fdata(words + 1, f1, SMBMIN(words + 1 + wct * 2, maxbuf),
+ smb_fdata(words + 1, f1, min(words + 1 + wct * 2, maxbuf),
- print_data(words + 1, SMBMIN(wct * 2, PTR_DIFF(maxbuf, words + 1)));
+ print_data(words + 1, min(wct * 2, PTR_DIFF(maxbuf, words + 1)));
TCHECK2(*data, 2);
bcc = EXTRACT_LE_16BITS(data);
printf("smb_bcc=%u\n", bcc);
if (bcc > 0) {
if (f2)
TCHECK2(*data, 2);
bcc = EXTRACT_LE_16BITS(data);
printf("smb_bcc=%u\n", bcc);
if (bcc > 0) {
if (f2)
- smb_fdata(data + 2, f2, SMBMIN(data + 2 + EXTRACT_LE_16BITS(data),
+ smb_fdata(data + 2, f2, min(data + 2 + EXTRACT_LE_16BITS(data),
maxbuf), unicodestr);
else
maxbuf), unicodestr);
else
- print_data(data + 2, SMBMIN(EXTRACT_LE_16BITS(data), PTR_DIFF(maxbuf, data + 2)));
+ print_data(data + 2, min(EXTRACT_LE_16BITS(data), PTR_DIFF(maxbuf, data + 2)));
f1 = "Com2=[w]\nOff2=[d]\n";
}
f1 = "Com2=[w]\nOff2=[d]\n";
}
- maxwords = SMBMIN(words + 1 + wct * 2, maxbuf);
+ maxwords = min(words + 1 + wct * 2, maxbuf);
if (wct)
smb_fdata(words + 1, f1, maxwords, unicodestr);
if (wct)
smb_fdata(words + 1, f1, maxwords, unicodestr);
printf("smb_bcc=%u\n", bcc);
if (bcc > 0) {
if (f2)
printf("smb_bcc=%u\n", bcc);
if (bcc > 0) {
if (f2)
- smb_fdata(data + 2, f2, SMBMIN(data + 2 + EXTRACT_LE_16BITS(data),
+ smb_fdata(data + 2, f2, min(data + 2 + EXTRACT_LE_16BITS(data),
maxbuf), unicodestr);
else
maxbuf), unicodestr);
else
- print_data(data + 2, SMBMIN(EXTRACT_LE_16BITS(data), PTR_DIFF(maxbuf, data + 2)));
+ print_data(data + 2, min(EXTRACT_LE_16BITS(data), PTR_DIFF(maxbuf, data + 2)));
TCHECK(words[0]);
wct = words[0];
data = words + 1 + wct * 2;
TCHECK(words[0]);
wct = words[0];
data = words + 1 + wct * 2;
- maxwords = SMBMIN(data, maxbuf);
+ maxwords = min(data, maxbuf);
if (request) {
f1 = fn->descript.req_f1;
if (request) {
f1 = fn->descript.req_f1;
} else {
if (bcc > 0) {
printf("smb_buf[]=\n");
} else {
if (bcc > 0) {
printf("smb_buf[]=\n");
- print_data(data + 2, SMBMIN(bcc, PTR_DIFF(maxbuf, data + 2)));
+ print_data(data + 2, min(bcc, PTR_DIFF(maxbuf, data + 2)));
if (frame_offset > remaining_len)
ND_PRINT((ndo, " (%"PRIu64" captured)", remaining_len));
if (ndo->ndo_vflag) {
if (frame_offset > remaining_len)
ND_PRINT((ndo, " (%"PRIu64" captured)", remaining_len));
if (ndo->ndo_vflag) {
- u_int64_t len_printed = MIN(frame_offset, remaining_len);
+ u_int64_t len_printed = min(frame_offset, remaining_len);
if (ndo->ndo_vflag == 1)
len_printed = MIN(VBYTES, len_printed);
if (ndo->ndo_vflag == 1)
len_printed = MIN(VBYTES, len_printed);
void
zmtp1_print_datagram(netdissect_options *ndo, const u_char *cp, const u_int len) {
void
zmtp1_print_datagram(netdissect_options *ndo, const u_char *cp, const u_int len) {
- const u_char *ep = MIN(ndo->ndo_snapend, cp + len);
+ const u_char *ep = min(ndo->ndo_snapend, cp + len);
cp = zmtp1_print_intermediate_part(ndo, cp, len);
while (cp < ep)
cp = zmtp1_print_intermediate_part(ndo, cp, len);
while (cp < ep)
-#define SMBMIN(a,b) ((a)<(b)?(a):(b))
-
/* the complete */
#define SMBmkdir 0x00 /* create directory */
#define SMBrmdir 0x01 /* delete directory */
/* the complete */
#define SMBmkdir 0x00 /* create directory */
#define SMBrmdir 0x01 /* delete directory */
print_asc(&buf[i - (i % 16)], n);
printf(" ");
n = (i % 16) - n;
print_asc(&buf[i - (i % 16)], n);
printf(" ");
n = (i % 16) - n;
* end of Apple deprecation workaround macros
*/
* end of Apple deprecation workaround macros
*/
+#ifndef min
+#define min(a,b) ((a)>(b)?(b):(a))
+#endif
+#ifndef max
+#define max(a,b) ((b)>(a)?(b):(a))
+#endif
+
#endif /* tcpdump_stdinc_h */
#endif /* tcpdump_stdinc_h */