Commit 893dcdbf authored by Yuval Shaia's avatar Yuval Shaia Committed by Samuel Thibault
Browse files

slirp, disas: Replace min/max with MIN/MAX macros

parent 82ecffa8
Loading
Loading
Loading
Loading
+2 −6
Original line number Diff line number Diff line
@@ -4698,10 +4698,6 @@ get_field (const unsigned char *data, enum floatformat_byteorders order,
  return result;
}

#ifndef min
#define min(a, b) ((a) < (b) ? (a) : (b))
#endif

/* Convert from FMT to a double.
   FROM is the address of the extended float.
   Store the double in *TO.  */
@@ -4733,7 +4729,7 @@ floatformat_to_double (const struct floatformat *fmt,
      nan = 0;
      while (mant_bits_left > 0)
	{
	  mant_bits = min (mant_bits_left, 32);
          mant_bits = MIN(mant_bits_left, 32);

	  if (get_field (ufrom, fmt->byteorder, fmt->totalsize,
			 mant_off, mant_bits) != 0)
@@ -4793,7 +4789,7 @@ floatformat_to_double (const struct floatformat *fmt,

  while (mant_bits_left > 0)
    {
      mant_bits = min (mant_bits_left, 32);
      mant_bits = MIN(mant_bits_left, 32);

      mant = get_field (ufrom, fmt->byteorder, fmt->totalsize,
			 mant_off, mant_bits);
+1 −1
Original line number Diff line number Diff line
@@ -168,7 +168,7 @@ static void dhcpv6_info_request(Slirp *slirp, struct sockaddr_in6 *srcsas,
                        sa[0], sa[1], sa[2], sa[3], sa[4], sa[5], sa[6], sa[7],
                        sa[8], sa[9], sa[10], sa[11], sa[12], sa[13], sa[14],
                        sa[15], slirp->bootp_filename);
        slen = min(slen, smaxlen);
        slen = MIN(slen, smaxlen);
        *resp++ = slen >> 8;                    /* option-len high byte */
        *resp++ = slen;                         /* option-len low byte */
        resp += slen;
+1 −1
Original line number Diff line number Diff line
@@ -95,7 +95,7 @@ void icmp6_send_error(struct mbuf *m, uint8_t type, uint8_t code)
#endif

    rip->ip_nh = IPPROTO_ICMPV6;
    const int error_data_len = min(m->m_len,
    const int error_data_len = MIN(m->m_len,
            IF_MTU - (sizeof(struct ip6) + ICMP6_ERROR_MINLEN));
    rip->ip_pl = htons(ICMP6_ERROR_MINLEN + error_data_len);
    t->m_len = sizeof(struct ip6) + ntohs(rip->ip_pl);
+1 −1
Original line number Diff line number Diff line
@@ -774,7 +774,7 @@ void slirp_pollfds_poll(GArray *pollfds, int select_error)
static void arp_input(Slirp *slirp, const uint8_t *pkt, int pkt_len)
{
    struct slirp_arphdr *ah = (struct slirp_arphdr *)(pkt + ETH_HLEN);
    uint8_t arp_reply[max(ETH_HLEN + sizeof(struct slirp_arphdr), 64)];
    uint8_t arp_reply[MAX(ETH_HLEN + sizeof(struct slirp_arphdr), 64)];
    struct ethhdr *reh = (struct ethhdr *)arp_reply;
    struct slirp_arphdr *rah = (struct slirp_arphdr *)(arp_reply + ETH_HLEN);
    int ar_op;
+0 −5
Original line number Diff line number Diff line
@@ -292,9 +292,4 @@ int tcp_emu(struct socket *, struct mbuf *);
int tcp_ctl(struct socket *);
struct tcpcb *tcp_drop(struct tcpcb *tp, int err);

#ifndef _WIN32
#define min(x,y) ((x) < (y) ? (x) : (y))
#define max(x,y) ((x) > (y) ? (x) : (y))
#endif

#endif
Loading