File:  [DVB] / dietlibc / lib / atol.c
Revision 1.7: download - view: text, annotated - select for diffs
Tue May 2 21:41:27 2017 UTC (7 years, 1 month ago) by leitner
Branches: MAIN
CVS tags: HEAD
remove most gcc 7 warnings

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

long int atol(const char* s) {
  long int v=0;
  int sign=0;
  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?-v:v;
}

#if __WORDSIZE == 64
long long int atoll(const char* s) __attribute__((alias("atol")));
#else
int atoi(const char* s) __attribute__((alias("atol")));
#endif

LinuxTV legacy CVS <linuxtv.org/cvs>