forked from github/server
Merge branch 'master' of github.com:ennorehling/eressea
This commit is contained in:
commit
3d57d2b77f
1 changed files with 10 additions and 1 deletions
|
@ -21,12 +21,20 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
#include "log.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#define USE_STRTOL
|
||||
#ifdef USE_STRTOL
|
||||
int atoi36(const char *str)
|
||||
{
|
||||
assert(str);
|
||||
return (int)strtol(str, NULL, 36);
|
||||
}
|
||||
#else
|
||||
int atoi36(const char *str)
|
||||
{
|
||||
/* cannot use strtol, because invalid strings will cause crash */
|
||||
const unsigned char *s = (const unsigned char *)str;
|
||||
int i = 0, sign = 1;
|
||||
assert(s);
|
||||
|
@ -51,6 +59,7 @@ int atoi36(const char *str)
|
|||
return 0;
|
||||
return i * sign;
|
||||
}
|
||||
#endif
|
||||
|
||||
const char *itoab_r(int i, int base, char *s, size_t len)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue