Fixes for parse.gperf on gcc2 Haiku build (perhaps others?).

This commit is contained in:
Scott McCreary 2010-06-04 01:42:54 +00:00
parent a7565f55ba
commit ba4b907d49

View file

@ -157,6 +157,13 @@ windowsize, MULTI(parsertmp_windowsize)
void parse_one_option(struct cfginfo *restrict tmpcfg, const char *str, const char *opt, const char *restrict src) void parse_one_option(struct cfginfo *restrict tmpcfg, const char *str, const char *opt, const char *restrict src)
{ {
int noflag;
uintptr_t uintptr;
unsigned flags;
unsigned offset;
char *dupecheck;
const struct cfg *cfg;
//printf("parsing: <%s> <%s>\n",str,arg); //printf("parsing: <%s> <%s>\n",str,arg);
if(isdigit(*str)) if(isdigit(*str))
@ -167,11 +174,11 @@ void parse_one_option(struct cfginfo *restrict tmpcfg, const char *str, const ch
str = "windowsize"; str = "windowsize";
} }
int noflag = 2*(str[0]=='n' && str[1]=='o' && str[2]); noflag = 2*(str[0]=='n' && str[1]=='o' && str[2]);
const struct cfg *cfg = in_word_set(str+noflag, strlen(str+noflag)); cfg = in_word_set(str+noflag, strlen(str+noflag));
uintptr_t uintptr = cfg ? (uintptr_t)cfg->val : 0; uintptr = cfg ? (uintptr_t)cfg->val : 0;
unsigned flags = (uintptr<CFGINFO_MAXOFFSET) ? (uintptr & FLAGMASK) : 0; flags = (uintptr<CFGINFO_MAXOFFSET) ? (uintptr & FLAGMASK) : 0;
if(!cfg || (!(flags & BOOLMASK) && noflag) ) if(!cfg || (!(flags & BOOLMASK) && noflag) )
{ {
@ -226,9 +233,8 @@ void parse_one_option(struct cfginfo *restrict tmpcfg, const char *str, const ch
exit(52); exit(52);
} }
unsigned offset = uintptr &~ FLAGMASK; offset = uintptr &~ FLAGMASK;
char *dupecheck;
memcpy(&dupecheck, offset+(char*)tmpcfg, sizeof(char*)); memcpy(&dupecheck, offset+(char*)tmpcfg, sizeof(char*));
if(dupecheck) if(dupecheck)
{ {