File:  [DVB] / dietlibc / lib / atoll.c
Revision 1.5: download - view: text, annotated - select for diffs
Wed Oct 3 13:40:57 2018 UTC (5 years, 8 months ago) by leitner
Branches: MAIN
CVS tags: HEAD
  putenv removes duplicate entries from malicious environments (Daniel Hodson)
  fix gcc warning in atoll

#include <endian.h>
#include <ctype.h>
#include <stdlib.h>

#if __WORDSIZE != 64
long long int atoll(const char* s) {
  long long int v=0;
  int sign=1;
  while ( *s == ' '  ||  (unsigned int)(*s - 9) < 5u) ++s;
  switch (*s) {
  case '-': sign=-1; /* fall through */
  case '+': ++s;
  }
  while ((unsigned int) (*s - '0') < 10u) {
    v=v*10+*s-'0'; ++s;
  }
  return sign==-1?-v:v;
}
#endif

LinuxTV legacy CVS <linuxtv.org/cvs>