ucx/ucx/utils.h

changeset 505
481802342fdf
parent 335
c1bc13faadaa
--- a/ucx/ucx/utils.h	Mon Feb 04 14:11:57 2019 +0100
+++ b/ucx/ucx/utils.h	Mon Feb 04 17:17:48 2019 +0100
@@ -38,10 +38,6 @@
 #ifndef UCX_UTILS_H
 #define UCX_UTILS_H
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-
 #include "ucx.h"
 #include "string.h"
 #include "allocator.h"
@@ -49,6 +45,10 @@
 #include <string.h>
 #include <stdarg.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /**
  * Default buffer size for ucx_stream_copy() and ucx_stream_ncopy().
  */
@@ -144,7 +144,7 @@
  * @param data omitted
  * @return the result of strcmp(s1, s2)
  */
-int ucx_strcmp(const void *s1, const void *s2, void *data);
+int ucx_cmp_str(const void *s1, const void *s2, void *data);
 
 /**
  * Wraps the strncmp function.
@@ -153,7 +153,16 @@
  * @param n a pointer to the size_t containing the third strncmp parameter
  * @return the result of strncmp(s1, s2, *n)
  */
-int ucx_strncmp(const void *s1, const void *s2, void *n);
+int ucx_cmp_strn(const void *s1, const void *s2, void *n);
+
+/**
+ * Wraps the sstrcmp function.
+ * @param s1 sstr one
+ * @param s2 sstr two
+ * @param data ignored
+ * @return the result of sstrcmp(s1, s2)
+ */
+int ucx_cmp_sstr(const void *s1, const void *s2, void *data);
 
 /**
  * Compares two integers of type int.
@@ -163,7 +172,36 @@
  * @return -1, if *i1 is less than *i2, 0 if both are equal,
  * 1 if *i1 is greater than *i2
  */
-int ucx_intcmp(const void *i1, const void *i2, void *data);
+int ucx_cmp_int(const void *i1, const void *i2, void *data);
+
+/**
+ * Compares two integers of type long int.
+ * @param i1 pointer to long integer one
+ * @param i2 pointer to long integer two
+ * @param data omitted
+ * @return -1, if *i1 is less than *i2, 0 if both are equal,
+ * 1 if *i1 is greater than *i2
+ */
+int ucx_cmp_longint(const void *i1, const void *i2, void *data);
+
+
+/**
+ * Distance function for integers of type int.
+ * @param i1 pointer to integer one
+ * @param i2 pointer to integer two
+ * @param data omitted
+ * @return i1 minus i2
+ */
+intmax_t ucx_dist_int(const void *i1, const void *i2, void *data);
+
+/**
+ * Distance function for integers of type long int.
+ * @param i1 pointer to long integer one
+ * @param i2 pointer to long integer two
+ * @param data omitted
+ * @return i1 minus i2
+ */
+intmax_t ucx_dist_longint(const void *i1, const void *i2, void *data);
 
 /**
  * Compares two real numbers of type float.
@@ -174,7 +212,7 @@
  * 1 if *f1 is greater than *f2
  */
 
-int ucx_floatcmp(const void *f1, const void *f2, void *data);
+int ucx_cmp_float(const void *f1, const void *f2, void *data);
 
 /**
  * Compares two real numbers of type double.
@@ -184,7 +222,7 @@
  * @return -1, if *d1 is less than *d2, 0 if both are equal,
  * 1 if *d1 is greater than *d2
  */
-int ucx_doublecmp(const void *d1, const void *d2, void *data);
+int ucx_cmp_double(const void *d1, const void *d2, void *data);
 
 /**
  * Compares two pointers.
@@ -194,7 +232,7 @@
  * @return -1 if ptr1 is less than ptr2, 0 if both are equal,
  * 1 if ptr1 is greater than ptr2
  */
-int ucx_ptrcmp(const void *ptr1, const void *ptr2, void *data);
+int ucx_cmp_ptr(const void *ptr1, const void *ptr2, void *data);
 
 /**
  * Compares two memory areas.
@@ -203,7 +241,7 @@
  * @param n a pointer to the size_t containing the third parameter for memcmp
  * @return the result of memcmp(ptr1, ptr2, *n)
  */
-int ucx_memcmp(const void *ptr1, const void *ptr2, void *n);
+int ucx_cmp_mem(const void *ptr1, const void *ptr2, void *n);
 
 /**
  * A <code>printf()</code> like function which writes the output to a stream by

mercurial