Merge branch 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelv...
[deliverable/linux.git] / arch / x86 / boot / string.c
CommitLineData
5be86566
PA
1/* -*- linux-c -*- ------------------------------------------------------- *
2 *
3 * Copyright (C) 1991, 1992 Linus Torvalds
4 * Copyright 2007 rPath, Inc. - All Rights Reserved
5 *
6 * This file is part of the Linux kernel, and is made available under
7 * the terms of the GNU General Public License version 2.
8 *
9 * ----------------------------------------------------------------------- */
10
11/*
5be86566
PA
12 * Very basic string functions
13 */
14
15#include "boot.h"
16
17int strcmp(const char *str1, const char *str2)
18{
19 const unsigned char *s1 = (const unsigned char *)str1;
20 const unsigned char *s2 = (const unsigned char *)str2;
21 int delta = 0;
22
23 while (*s1 || *s2) {
24 delta = *s2 - *s1;
25 if (delta)
26 return delta;
27 s1++;
28 s2++;
29 }
30 return 0;
31}
32
33size_t strnlen(const char *s, size_t maxlen)
34{
35 const char *es = s;
36 while (*es && maxlen) {
37 es++;
38 maxlen--;
39 }
40
41 return (es - s);
42}
43
44unsigned int atou(const char *s)
45{
46 unsigned int i = 0;
47 while (isdigit(*s))
48 i = i * 10 + (*s++ - '0');
49 return i;
50}
This page took 0.28605 seconds and 5 git commands to generate.