source: rtems/cpukit/libmisc/stringto/stringtopointer.c @ 97315f51

4.10
Last change on this file since 97315f51 was 97315f51, checked in by Ralf Corsepius <ralf.corsepius@…>, on 02/02/11 at 02:30:10

Backport from CVS-HEAD.

  • Property mode set to 100644
File size: 1.1 KB
Line 
1/*
2 *  COPYRIGHT (c) 2009.
3 *  On-Line Applications Research Corporation (OAR).
4 *
5 *  Copyright (c) 2011  Ralf Corsépius, Ulm, Germany.
6 *
7 *  The license and distribution terms for this file may be
8 *  found in the file LICENSE in this distribution or at
9 *  http://www.rtems.com/license/LICENSE.
10 *
11 *  $Id$
12 */
13
14#ifdef HAVE_CONFIG_H
15#include "config.h"
16#endif
17
18#include <errno.h>
19#include <stdlib.h>
20#include <limits.h>
21#include <stdint.h>
22
23#include <rtems/stringto.h>
24
25/*
26 *  Instantiate an error checking wrapper for strtoul/strtoull (void *)
27 */
28
29#if (UINTPTR_MAX == ULONG_MAX)
30#define STRTOFUNC(a,b,c)        rtems_string_to_unsigned_long(a, (unsigned long*) b, c, 0)
31#elif (UINTPTR_MAX == ULONG_LONG_MAX)
32#define STRTOFUNC(a,b,c)        rtems_string_to_unsigned_long_long(a, (unsigned long long*) b, c, 0)
33#elif (UINTPTR_MAX == UINT_MAX)
34#define STRTOFUNC(a,b,c)        rtems_string_to_unsigned_int(a, (unsigned int*) b, c, 0)
35#else
36/* Fallback to unsigned long */
37#define STRTOFUNC(a,b,c)        rtems_string_to_unsigned_long(a, (unsigned long*) b, c, 0)
38#endif
39
40rtems_status_code rtems_string_to_pointer (
41  const char *s,
42  void **n,
43  char **endptr
44)
45{
46  return STRTOFUNC( s, n, endptr );
47}
Note: See TracBrowser for help on using the repository browser.