]> mj.ucw.cz Git - libucw.git/commitdiff
Extended types: Introduced naming convention for xtype format macros
authorMartin Mares <mj@ucw.cz>
Fri, 25 Jul 2014 11:25:34 +0000 (13:25 +0200)
committerMartin Mares <mj@ucw.cz>
Fri, 25 Jul 2014 11:25:34 +0000 (13:25 +0200)
For xt_something, let's use XT_SOMETHING_FMT_...

ucw/xtypes-basic.c
ucw/xtypes.h

index 14c77d2182c9413eb3df033ded1ccbe2ee2e526a..26d7cb1f54b191ac64cdbcd2014573d83ed09a73 100644 (file)
@@ -50,9 +50,9 @@ static const char *xt_double_format(void *src, u32 fmt, struct mempool *pool)
 {
   double val = *((double *)src);
 
-  if (fmt & XTYPE_FMT_DBL_PREC)
+  if (fmt & XT_DOUBLE_FMT_PREC_FLAG)
     {
-      uint prec = fmt & ~XTYPE_FMT_DBL_PREC;
+      uint prec = fmt & ~XT_DOUBLE_FMT_PREC_FLAG;
       return mp_printf(pool, "%.*lf", prec, val);
     }
 
@@ -88,7 +88,7 @@ static const char * xt_double_fmt_parse(const char *str, u32 *dest, struct mempo
   if (tmp_err)
     return mp_printf(pool, "Could not parse floating point number precision: %s", tmp_err);
 
-  *dest = XTYPE_FMT_DBL_FIXED_PREC(precision);
+  *dest = XT_DOUBLE_FMT_PREC(precision);
   return NULL;
 }
 
index f0e892771a44e0df012798ceea46315a15236798..06ecd808b1c3ba6d364d08d1d32f486584e14c26 100644 (file)
@@ -114,8 +114,8 @@ extern const struct xtype xt_bool;
 extern const struct xtype xt_double;
 
 // Fixed-precision formats for xt_double
-#define XTYPE_FMT_DBL_FIXED_PREC(_prec) (_prec | XTYPE_FMT_DBL_PREC)
-#define XTYPE_FMT_DBL_PREC XTYPE_FMT_CUSTOM
+#define XT_DOUBLE_FMT_PREC(_prec) (_prec | XT_DOUBLE_FMT_PREC_FLAG)
+#define XT_DOUBLE_FMT_PREC_FLAG XTYPE_FMT_CUSTOM
 
 /* Tables of units, provided as convenience for the implementations of xtypes */