[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Confuse-devel] integer base 10 in CFG_INT
From: |
Peter Cordes |
Subject: |
[Confuse-devel] integer base 10 in CFG_INT |
Date: |
Wed, 28 Oct 2009 16:48:37 -0300 |
User-agent: |
Mutt/1.5.18 (2008-05-17) |
Another issue I ran into with libconfuse was that I wanted to parse
08 in base 10, not let (confuse.c line 615, in cfg_setopt)
val->number = strtol(value, &endptr, 0);
decide that it's octal, and then choke on the 8.
I just changed the 0 to 10 in my copy of libconfuse, but perhaps
there should be CFGF_BASE10, and CFGF_BASE16, and CFGF_BASE_AUTO flags
to select the base passed to strtol. I'd suggest making the default
BASE10, since that's what I was expecting without having given it any
thought at all.
int base = 10;
if (is_set(CFGF_BASE_AUTO, opt->flags)) base = 0;
else if (is_set(CFGF_BASE16, opt->flags)) base = 16;
else
base = 10;
// if (is_set(CFGF_BASE10, opt->flags)) base = 10; // default anyway
--
#define X(x,y) x##y
Peter Cordes ; e-mail: X(address@hidden , des.ca)
"The gods confound the man who first found out how to distinguish the hours!
Confound him, too, who in this place set up a sundial, to cut and hack
my day so wretchedly into small pieces!" -- Plautus, 200 BC
signature.asc
Description: Digital signature
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Confuse-devel] integer base 10 in CFG_INT,
Peter Cordes <=