From 03a2b5db9adcfaeaaec12c991cd648926800bbde Mon Sep 17 00:00:00 2001 From: Tomas Valla Date: Mon, 2 Jun 2014 18:02:31 +0200 Subject: [PATCH] Returned back 'uns' and related functions for backwards compatibility. --- maint/libucw.abi | 2 ++ ucw/conf.h | 6 ++++++ ucw/config.h | 5 +++-- ucw/opt.h | 5 +++++ ucw/strtonum.c | 5 +++++ ucw/strtonum.h | 6 ++++++ 6 files changed, 27 insertions(+), 2 deletions(-) diff --git a/maint/libucw.abi b/maint/libucw.abi index 27ddbd28..b4fbcd0c 100644 --- a/maint/libucw.abi +++ b/maint/libucw.abi @@ -497,6 +497,8 @@ str_hier_suffix # ucw/strtonum.h str_to_uintmax str_to_uint +# FIXME +str_to_uns # ucw/tbf.h tbf_init tbf_limit diff --git a/ucw/conf.h b/ucw/conf.h index e99d6e31..11026b7a 100644 --- a/ucw/conf.h +++ b/ucw/conf.h @@ -356,6 +356,12 @@ struct cf_section { /** A section. **/ #define CF_IP(n,p) CF_STATIC(n,p,IP,u32,1) /** Single IPv4 address. **/ #define CF_IP_ARY(n,p,c) CF_STATIC(n,p,IP,u32,c) /** Static array of IP addresses. **/. #define CF_IP_DYN(n,p,c) CF_DYNAMIC(n,p,IP,u32,c) /** Dynamic array of IP addresses. **/ + +/* FIXME: Backwards compatibility only, should not be used at is will be removed soon. */ +#define CF_UNS CF_UINT +#define CF_UNS_ARY CF_UINT_ARY +#define CF_UNS_DYN CF_UINT_DYN + /** * A string. * You provide a pointer to a `char *` variable and it will fill it with diff --git a/ucw/config.h b/ucw/config.h index ffe61fc9..a4768b72 100644 --- a/ucw/config.h +++ b/ucw/config.h @@ -37,10 +37,11 @@ typedef uint64_t u64; /** Exactly 64 bits, unsigned **/ typedef int64_t s64; /** Exactly 64 bits, signed **/ typedef unsigned int uint; /** A better pronounceable alias for `unsigned int` **/ -// FIXME -// typedef uint uns; /** Backwards compatible alias for `uint' ***/ typedef s64 timestamp_t; /** Milliseconds since an unknown epoch **/ +// FIXME: This should be removed soon +typedef uint uns; /** Backwards compatible alias for `uint' ***/ + #ifdef CONFIG_UCW_LARGE_FILES typedef s64 ucw_off_t; /** File position (either 32- or 64-bit, depending on `CONFIG_UCW_LARGE_FILES`). **/ #else diff --git a/ucw/opt.h b/ucw/opt.h index 5831102a..557cadb1 100644 --- a/ucw/opt.h +++ b/ucw/opt.h @@ -206,6 +206,11 @@ struct opt_item { /** Incrementing option. @target should be a variable of type `int`. **/ #define OPT_INC(shortopt, longopt, target, fl, desc) { .letter = shortopt, .name = longopt, .ptr = CHECK_PTR_TYPE(&target, int *), .flags = fl, .help = desc, .cls = OPT_CL_INC, .type = CT_INT } +/* FIXME: Backwards compatibility only, should not be used anymore. */ +#define OPT_UNS OPT_UINT +#define OPT_UNS_MULTIPLE OPT_UINT_MULTIPLE + + /** * When this option appears, call the function @fn with parameters @item, @value, @data, * where @item points to the <> of this option, diff --git a/ucw/strtonum.c b/ucw/strtonum.c index 6667d47e..8468cf75 100644 --- a/ucw/strtonum.c +++ b/ucw/strtonum.c @@ -105,3 +105,8 @@ static inline uint get_digit(const uint c) #define STN_TYPE uintmax_t #define STN_SUFFIX uintmax #include + +// FIXME: For backwards compatibility, will be removed soon +#define STN_TYPE uns +#define STN_SUFFIX uns +#include diff --git a/ucw/strtonum.h b/ucw/strtonum.h index 224a753a..fc99e237 100644 --- a/ucw/strtonum.h +++ b/ucw/strtonum.h @@ -13,6 +13,9 @@ #ifdef CONFIG_UCW_CLEAN_ABI #define str_to_uintmax ucw_str_to_uintmax #define str_to_uint ucw_str_to_uint + +// FIXME: For backwards compatibility, will be removed soon +#define str_to_uns ucw_str_to_uns #endif // Set (flags & 0x1f) in the range 1 to 31 to denote the default base of the number @@ -54,4 +57,7 @@ STN_SIGNED_CONVERTOR(int, int, uint) STN_DECLARE_CONVERTOR(uintmax_t, uintmax); STN_SIGNED_CONVERTOR(intmax_t, intmax, uintmax) +// FIXME: For backwards compatibility, will be removed soon +STN_DECLARE_CONVERTOR(uns, uns); + #endif -- 2.39.2