forked from Qortal/Brooklyn
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
383 B
25 lines
383 B
3 years ago
|
#include <linux/dcache.h>
|
||
|
#include "internal.h"
|
||
|
|
||
|
unsigned name_to_int(const struct qstr *qstr)
|
||
|
{
|
||
|
const char *name = qstr->name;
|
||
|
int len = qstr->len;
|
||
|
unsigned n = 0;
|
||
|
|
||
|
if (len > 1 && *name == '0')
|
||
|
goto out;
|
||
|
do {
|
||
|
unsigned c = *name++ - '0';
|
||
|
if (c > 9)
|
||
|
goto out;
|
||
|
if (n >= (~0U-9)/10)
|
||
|
goto out;
|
||
|
n *= 10;
|
||
|
n += c;
|
||
|
} while (--len > 0);
|
||
|
return n;
|
||
|
out:
|
||
|
return ~0U;
|
||
|
}
|