X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fdata%2Fvalue.h;h=6955eea0bd358e144fc1bd4ff8ed9e615aa7b68f;hb=a34c42168e0cd3373860a6cc3f518cb0e329db47;hp=90f8575356a24a873a0dbf4f9df41d60d8fca1ce;hpb=18021ef879fa68dbec546155311d6676653cf7c3;p=pspp-builds.git diff --git a/src/data/value.h b/src/data/value.h index 90f85753..6955eea0 100644 --- a/src/data/value.h +++ b/src/data/value.h @@ -23,6 +23,11 @@ #include #include "xalloc.h" +/* Maximum length of a "short" string, that is represented in + "union value" without a separate pointer. + + This is an implementation detail of the "union value" code. + There is little reason for client code to use it. */ #define MAX_SHORT_STRING 8 /* A numeric or string value. @@ -53,9 +58,6 @@ static inline double value_num (const union value *); static inline const char *value_str (const union value *, int width); static inline char *value_str_rw (union value *, int width); -int compare_values (const void *, const void *, const void *var); -unsigned hash_value (const void *, const void *var); - static inline void value_copy (union value *, const union value *, int width); void value_copy_rpad (union value *, int dst_width, const union value *, int src_width, @@ -67,12 +69,14 @@ void value_copy_buf_rpad (union value *dst, int dst_width, void value_set_missing (union value *, int width); int value_compare_3way (const union value *, const union value *, int width); bool value_equal (const union value *, const union value *, int width); -size_t value_hash (const union value *, int width, unsigned int basis); +unsigned int value_hash (const union value *, int width, unsigned int basis); bool value_is_resizable (const union value *, int old_width, int new_width); bool value_needs_resize (int old_width, int new_width); void value_resize (union value *, int old_width, int new_width); +static inline void value_swap (union value *, union value *); + struct pool; void value_init_pool (struct pool *, union value *, int width); void value_resize_pool (struct pool *, union value *, @@ -175,4 +179,13 @@ value_copy (union value *dst, const union value *src, int width) memcpy (dst->long_string, src->long_string, width); } +/* Exchanges the contents of A and B. */ +static inline void +value_swap (union value *a, union value *b) +{ + union value tmp = *a; + *a = *b; + *b = tmp; +} + #endif /* data/value.h */