hc
2024-05-09 b9d5c334faa47a75f1f28e72d203fc0334e8471d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// SPDX-License-Identifier: GPL-2.0
/*
 * Copyright (c) 2019 Fuzhou Rockchip Electronics Co., Ltd
 */
 
#include <linux/ctype.h>
#include <linux/types.h>
 
long atol(const char *nptr)
{
   int c;
   long total;
   int sign;
 
   while (isspace((int)(unsigned char)*nptr))
       ++nptr;
 
   c = (int)(unsigned char)*nptr++;
   sign = c;
   if (c == '-' || c == '+')
       c = (int)(unsigned char)*nptr++;
 
   total = 0;
 
   while (isdigit(c)) {
       total = 10 * total + (c - '0');
       c = (int)(unsigned char)*nptr++;
   }
 
   if (sign == '-')
       return -total;
   else
       return total;
}
 
int atoi(const char *nptr)
{
   return (int)atol(nptr);
}