X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fdata%2Fvalue.h;h=9205bc1a031feec0bee4d6858ca5af3b2e3d0b2e;hb=fd2104e10011b87d6558e8623d629da4cee82b25;hp=84f08d87ce5da9241c07192fda84b45665eab365;hpb=8830c95bb9e8d72621787866141a27fc22e8c786;p=pspp-builds.git diff --git a/src/data/value.h b/src/data/value.h index 84f08d87..9205bc1a 100644 --- a/src/data/value.h +++ b/src/data/value.h @@ -1,5 +1,5 @@ /* PSPP - a program for statistical analysis. - Copyright (C) 1997-9, 2000, 2007, 2009 Free Software Foundation, Inc. + Copyright (C) 1997-9, 2000, 2007, 2009, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -51,6 +51,7 @@ union value }; static inline void value_init (union value *, int width); +static inline void value_clone (union value *, const union value *, int width); static inline bool value_needs_init (int width); static inline bool value_try_init (union value *, int width); static inline void value_destroy (union value *, int width); @@ -59,9 +60,6 @@ static inline double value_num (const union value *); static inline const uint8_t *value_str (const union value *, int width); static inline uint8_t *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, @@ -83,6 +81,8 @@ static inline void value_swap (union value *, union value *); struct pool; void value_init_pool (struct pool *, union value *, int width); +void value_clone_pool (struct pool *, union value *, const union value *, + int width); void value_resize_pool (struct pool *, union value *, int old_width, int new_width); @@ -101,6 +101,17 @@ value_init (union value *v, int width) v->long_string = xmalloc (width); } +/* Initializes V as a value of the given WIDTH, as with value_init(), and + copies SRC's value into V as its initial value. */ +static inline void +value_clone (union value *v, const union value *src, int width) +{ + if (width <= MAX_SHORT_STRING) + *v = *src; + else + v->long_string = xmemdup (src->long_string, width); +} + /* Returns true if a value of the given WIDTH actually needs to have the value_init and value_destroy functions called, false if those functions are no-ops for values of the given WIDTH.