diff options
Diffstat (limited to 'src/format.c')
| -rw-r--r-- | src/format.c | 38 |
1 files changed, 7 insertions, 31 deletions
diff --git a/src/format.c b/src/format.c index e924c6a..985a527 100644 --- a/src/format.c +++ b/src/format.c @@ -20,9 +20,6 @@ #undef HXformat_aprintf #undef HXformat_fprintf #undef HXformat_sprintf -extern int HXformat_aprintf(const struct HXformat_map *, hxmc_t **, const char *); -extern int HXformat_sprintf(const struct HXformat_map *, char *, size_t, const char *); -extern int HXformat_fprintf(const struct HXformat_map *, FILE *, const char *); /* To make it easier on the highlighter */ #define C_OPEN '(' @@ -380,7 +377,7 @@ static hxmc_t *HXformat2_xcall(const char *name, const char **pptr, hxmc_t *ret, *ret2, **argv; struct HXdeque *dq; const char *s, *delim; - int err = 0; + ssize_t err = 0; dq = HXdeque_init(); if (dq == NULL) @@ -563,13 +560,13 @@ HXformat2_xany(const char **pptr, const struct HXformat_map *blk) /* Closing parenthesis - variable */ const struct fmt_entry *entry; hxmc_t *new_name = NULL; - int eret; + ssize_t eret; *pptr = ++s; eret = HXformat_aprintf(blk, &new_name, name); if (eret <= 0) { ret = NULL; - } else if (*new_name == '\0') { + } else if (new_name == nullptr || *new_name == '\0') { ret = &HXformat2_nexp; } else { entry = HXmap_get(blk->vars, new_name); @@ -630,14 +627,7 @@ EXPORT_SYMBOL struct HXformat_map *HXformat_init(void) return NULL; } -EXPORT_SYMBOL int HXformat_aprintf(const struct HXformat_map *blk, - hxmc_t **resultp, const char *fmt) -{ - ssize_t ret = HXformat3_aprintf(blk, resultp, fmt); - return ret > INT_MAX ? INT_MAX : ret; -} - -EXPORT_SYMBOL ssize_t HXformat3_aprintf(const struct HXformat_map *blk, +EXPORT_SYMBOL ssize_t HXformat_aprintf(const struct HXformat_map *blk, hxmc_t **resultp, const char *fmt) { hxmc_t *ex, *ts, *out; @@ -686,20 +676,13 @@ EXPORT_SYMBOL ssize_t HXformat3_aprintf(const struct HXformat_map *blk, return ret; } -EXPORT_SYMBOL int HXformat_fprintf(const struct HXformat_map *ftable, - FILE *filp, const char *fmt) -{ - ssize_t ret = HXformat3_fprintf(ftable, filp, fmt); - return ret > INT_MAX ? INT_MAX : ret; -} - -EXPORT_SYMBOL ssize_t HXformat3_fprintf(const struct HXformat_map *ftable, +EXPORT_SYMBOL ssize_t HXformat_fprintf(const struct HXformat_map *ftable, FILE *filp, const char *fmt) { hxmc_t *str; ssize_t ret; - if ((ret = HXformat3_aprintf(ftable, &str, fmt)) <= 0) + if ((ret = HXformat_aprintf(ftable, &str, fmt)) <= 0) return ret; errno = 0; if (fputs(str, filp) < 0) @@ -708,14 +691,7 @@ EXPORT_SYMBOL ssize_t HXformat3_fprintf(const struct HXformat_map *ftable, return ret; } -EXPORT_SYMBOL int HXformat_sprintf(const struct HXformat_map *ftable, - char *dest, size_t size, const char *fmt) -{ - ssize_t ret = HXformat3_sprintf(ftable, dest, size, fmt); - return ret > INT_MAX ? INT_MAX : ret; -} - -EXPORT_SYMBOL ssize_t HXformat3_sprintf(const struct HXformat_map *ftable, +EXPORT_SYMBOL ssize_t HXformat_sprintf(const struct HXformat_map *ftable, char *dest, size_t size, const char *fmt) { hxmc_t *str = nullptr; |
