$OpenBSD: patch-snmplib_int64_c,v 1.1 2016/10/12 10:50:33 sthen Exp $

commit 477b4307ef12ddce3b6a9205e0bdddbfb2e0e9b6
Author: Bart Van Assche <bvanassche@acm.org>
Date:   Sat Feb 20 18:58:18 2016 -0800

    Remove U64 typedef

    The U64 typedef conflicts with a typedef in a Perl header file. Hence
    remove the U64 typedef from the Net-SNMP header files. This patch does
    not modify the Net-SNMP ABI.

--- snmplib/int64.c.orig	Mon Dec  8 20:23:22 2014
+++ snmplib/int64.c	Wed Oct 12 10:50:36 2016
@@ -33,7 +33,7 @@
  * @param[out] puR   Remainder.
  */
 void
-divBy10(U64 u64, U64 * pu64Q, unsigned int *puR)
+divBy10(struct counter64 u64, struct counter64 *pu64Q, unsigned int *puR)
 {
     unsigned long   ulT;
     unsigned long   ulQ;
@@ -83,7 +83,7 @@ divBy10(U64 u64, U64 * pu64Q, unsigned int *puR)
  * @param[out] pu64P Product.
  */
 void
-multBy10(U64 u64, U64 * pu64P)
+multBy10(struct counter64 u64, struct counter64 *pu64P)
 {
     unsigned long   ulT;
     unsigned long   ulP;
@@ -130,7 +130,7 @@ multBy10(U64 u64, U64 * pu64P)
  *
  */
 void
-incrByU16(U64 * pu64, unsigned int u16)
+incrByU16(struct counter64 *pu64, unsigned int u16)
 {
     incrByU32(pu64, u16);
 }
@@ -143,7 +143,7 @@ incrByU16(U64 * pu64, unsigned int u16)
  *
  */
 void
-incrByU32(U64 * pu64, unsigned int u32)
+incrByU32(struct counter64 *pu64, unsigned int u32)
 {
     uint32_t tmp;
 
@@ -161,7 +161,7 @@ incrByU32(U64 * pu64, unsigned int u32)
  * @param[out] pu64out pu64one - pu64two.
  */
 void
-u64Subtract(const U64 * pu64one, const U64 * pu64two, U64 * pu64out)
+u64Subtract(const struct counter64 *pu64one, const struct counter64 *pu64two, struct counter64 *pu64out)
 {
     int carry;
 
@@ -177,7 +177,7 @@ u64Subtract(const U64 * pu64one, const U64 * pu64two, 
  * @param[in,out] pu64out pu64out += pu64one.
  */
 void
-u64Incr(U64 * pu64out, const U64 * pu64one)
+u64Incr(struct counter64 *pu64out, const struct counter64 *pu64one)
 {
     pu64out->high = (uint32_t)(pu64out->high + pu64one->high);
     incrByU32(pu64out, pu64one->low);
@@ -191,9 +191,9 @@ u64Incr(U64 * pu64out, const U64 * pu64one)
  * @param[out] pu64out pu64out += (pu64one - pu64two)
  */
 void
-u64UpdateCounter(U64 * pu64out, const U64 * pu64one, const U64 * pu64two)
+u64UpdateCounter(struct counter64 *pu64out, const struct counter64 *pu64one, const struct counter64 *pu64two)
 {
-    U64 tmp;
+    struct counter64 tmp;
 
     u64Subtract(pu64one, pu64two, &tmp);
     u64Incr(pu64out, &tmp);
@@ -208,7 +208,7 @@ netsnmp_feature_child_of(u64copy, netsnmp_unused)
  * @param[out] pu64one Where to store the copy - *pu64one = *pu64two.
  */
 void
-u64Copy(U64 * pu64one, const U64 * pu64two)
+u64Copy(struct counter64 *pu64one, const struct counter64 *pu64two)
 {
     *pu64one = *pu64two;
 }
@@ -220,7 +220,7 @@ u64Copy(U64 * pu64one, const U64 * pu64two)
  * @param[in] pu64 Number to be zeroed.
  */
 void
-zeroU64(U64 * pu64)
+zeroU64(struct counter64 *pu64)
 {
     pu64->low = 0;
     pu64->high = 0;
@@ -232,7 +232,7 @@ zeroU64(U64 * pu64)
  * @param[in] pu64 Number to be checked.
  */
 int
-isZeroU64(const U64 * pu64)
+isZeroU64(const struct counter64 *pu64)
 {
     return pu64->low == 0 && pu64->high == 0;
 }
@@ -390,10 +390,10 @@ netsnmp_c64_check32_and_update(struct counter64 *prev_
 /** Convert an unsigned 64-bit number to ASCII. */
 void
 printU64(char *buf, /* char [I64CHARSZ+1]; */
-         const U64 * pu64)
+         const struct counter64 *pu64)
 {
-    U64             u64a;
-    U64             u64b;
+    struct counter64 u64a;
+    struct counter64 u64b;
 
     char            aRes[I64CHARSZ + 1];
     unsigned int    u;
@@ -414,9 +414,9 @@ printU64(char *buf, /* char [I64CHARSZ+1]; */
 /** Convert a signed 64-bit number to ASCII. */
 void
 printI64(char *buf, /* char [I64CHARSZ+1]; */
-         const U64 * pu64)
+         const struct counter64 *pu64)
 {
-    U64             u64a;
+    struct counter64 u64a;
 
     if (pu64->high & 0x80000000) {
         u64a.high = (uint32_t) ~pu64->high;
@@ -429,11 +429,11 @@ printI64(char *buf, /* char [I64CHARSZ+1]; */
     }
 }
 
-/** Convert a signed 64-bit integer from ASCII to U64. */
+/** Convert a signed 64-bit integer from ASCII to struct counter64. */
 int
-read64(U64 * i64, const char *str)
+read64(struct counter64 *i64, const char *str)
 {
-    U64             i64p;
+    struct counter64 i64p;
     unsigned int    u;
     int             sign = 0;
     int             ok = 0;
