pike.git / src / stralloc.c

version» Context lines:

pike.git/src/stralloc.c:3241:    switch(ptr.shift)    {    case 0: return MKPCHARP(memchr(ptr.ptr,chr,len),0);    case 1: return MKPCHARP(MEMCHR1((p_wchar1 *)ptr.ptr,chr,len),1);    case 2: return MKPCHARP(MEMCHR2((p_wchar2 *)ptr.ptr,chr,len),2);    }    UNREACHABLE(MKPCHARP(0,0));   }      #define DIGIT(x) ( (x)<256 ? hexdecode[x] : 16 ) + #define ISHEX(x) (DIGIT(x)<16)   #define MBASE ('z' - 'a' + 1 + 10)      PMOD_EXPORT long STRTOL_PCHARP(PCHARP str, PCHARP *ptr, unsigned int base)   {    /* Note: Code duplication in strtol and pcharp_to_svalue_inumber. */       unsigned long val, mul_limit;    int c;    unsigned add_limit, xx;    int neg = 0, overflow = 0;
pike.git/src/stralloc.c:3284:    if (c != '0')    base = 10;    else if (INDEX_PCHARP(str,1) == 'x' || INDEX_PCHARP(str,1) == 'X')    base = 16;    else    base = 8;    }       if ((val = DIGIT(c)) >= base)    return 0; /* no number formed */ -  if (base == 16 && c == '0' && isxdigit(INDEX_PCHARP(str,2)) && +  if (base == 16 && c == '0' && ISHEX(INDEX_PCHARP(str,2)) &&    (INDEX_PCHARP(str,1) == 'x' || INDEX_PCHARP(str,1) == 'X'))    {    INC_PCHARP(str,2);    c = EXTRACT_PCHARP(str); /* skip over leading "0x" or "0X" */    if ((val = DIGIT(c)) >= base)    return 0; /* no number formed */    }       mul_limit = ((unsigned long)LONG_MAX)/base;    add_limit = (int) (LONG_MAX % base);
pike.git/src/stralloc.c:3438:    else    base = 8;    }       if((val=DIGIT(c)) >= base)    return 0; /* No number formed. */       if(c == '0' &&    ((base==16 && (INDEX_PCHARP(str,1)=='x' || INDEX_PCHARP(str,1)=='X')) ||    (base==2 && (INDEX_PCHARP(str,1)=='b' || INDEX_PCHARP(str,1)=='B'))) && -  INDEX_PCHARP(str,2) < 256 && /* Don't trust isxdigit... */ -  isxdigit(INDEX_PCHARP(str,2))) +  ISHEX(INDEX_PCHARP(str,2)))    {    /* Skip over leading "0x", "0X", "0b" or "0B". */    INC_PCHARP(str,2);    c=EXTRACT_PCHARP(str);    if((val=DIGIT(c)) >= base)    return 0; /* No number formed. */    }    str_start=str;       if (neg) {