diff options
-rw-r--r-- | membuffer.c | 45 | ||||
-rw-r--r-- | membuffer.h | 10 |
2 files changed, 20 insertions, 35 deletions
diff --git a/membuffer.c b/membuffer.c index 8ba23ebe2..a222af60b 100644 --- a/membuffer.c +++ b/membuffer.c @@ -127,47 +127,32 @@ void put_milli(struct membuffer *b, const char *pre, int value, const char *post put_format(b, "%s%s%u.%s%s", pre, sign, v, buf, post); } -int put_temperature(struct membuffer *b, temperature_t temp, const char *pre, const char *post) +void put_temperature(struct membuffer *b, temperature_t temp, const char *pre, const char *post) { - if (!temp.mkelvin) - return 0; - - put_milli(b, pre, temp.mkelvin - ZERO_C_IN_MKELVIN, post); - return 1; + if (temp.mkelvin) + put_milli(b, pre, temp.mkelvin - ZERO_C_IN_MKELVIN, post); } -int put_depth(struct membuffer *b, depth_t depth, const char *pre, const char *post) +void put_depth(struct membuffer *b, depth_t depth, const char *pre, const char *post) { - if (!depth.mm) - return 0; - - put_milli(b, pre, depth.mm, post); - return 1; + if (depth.mm) + put_milli(b, pre, depth.mm, post); } -int put_duration(struct membuffer *b, duration_t duration, const char *pre, const char *post) +void put_duration(struct membuffer *b, duration_t duration, const char *pre, const char *post) { - if (!duration.seconds) - return 0; - - put_format(b, "%s%u:%02u%s", pre, FRACTION(duration.seconds, 60), post); - return 1; + if (duration.seconds) + put_format(b, "%s%u:%02u%s", pre, FRACTION(duration.seconds, 60), post); } -int put_pressure(struct membuffer *b, pressure_t pressure, const char *pre, const char *post) +void put_pressure(struct membuffer *b, pressure_t pressure, const char *pre, const char *post) { - if (!pressure.mbar) - return 0; - - put_milli(b, pre, pressure.mbar, post); - return 1; + if (pressure.mbar) + put_milli(b, pre, pressure.mbar, post); } -int put_salinity(struct membuffer *b, int salinity, const char *pre, const char *post) +void put_salinity(struct membuffer *b, int salinity, const char *pre, const char *post) { - if (!salinity) - return 0; - - put_format(b, "%s%d%s", pre, salinity / 10, post); - return 1; + if (salinity) + put_format(b, "%s%d%s", pre, salinity / 10, post); } diff --git a/membuffer.h b/membuffer.h index 3a7f633be..4386b1e11 100644 --- a/membuffer.h +++ b/membuffer.h @@ -51,11 +51,11 @@ extern void put_milli(struct membuffer *, const char *, int, const char *); * to the memory buffer (typically the post/pre will be some XML * pattern and unit string or whatever). */ -extern int put_temperature(struct membuffer *, temperature_t, const char *, const char *); -extern int put_depth(struct membuffer *, depth_t, const char *, const char *); -extern int put_duration(struct membuffer *, duration_t, const char *, const char *); -extern int put_pressure(struct membuffer *, pressure_t, const char *, const char *); -extern int put_salinity(struct membuffer *, int, const char *, const char *); +extern void put_temperature(struct membuffer *, temperature_t, const char *, const char *); +extern void put_depth(struct membuffer *, depth_t, const char *, const char *); +extern void put_duration(struct membuffer *, duration_t, const char *, const char *); +extern void put_pressure(struct membuffer *, pressure_t, const char *, const char *); +extern void put_salinity(struct membuffer *, int, const char *, const char *); #ifdef __cplusplus } |