Changeset 58dac48 in rtems


Ignore:
Timestamp:
Jan 31, 2011, 4:03:16 PM (8 years ago)
Author:
Ralf Corsepius <ralf.corsepius@…>
Branches:
4.11, master
Children:
10df690
Parents:
268531a
Message:

2011-01-31 Ralf Corsepius <ralf.corsepius@…>

  • libmisc/stringto/stringtopointer.c: Rework.
Location:
cpukit
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • cpukit/ChangeLog

    r268531a r58dac48  
     12011-01-31      Ralf Corsepius <ralf.corsepius@rtems.org>
     2
     3        * libmisc/stringto/stringtopointer.c: Rework.
     4
    152011-01-28      Joel Sherrill <joel.sherrilL@OARcorp.com>
    26
  • cpukit/libmisc/stringto/stringtopointer.c

    r268531a r58dac48  
    22 *  COPYRIGHT (c) 2009.
    33 *  On-Line Applications Research Corporation (OAR).
     4 *
     5 *  Copyright (c) 2011  Ralf Corsépius, Ulm, Germany.
    46 *
    57 *  The license and distribution terms for this file may be
     
    1416#endif
    1517
     18#include <errno.h>
     19#include <stdlib.h>
     20#include <limits.h>
     21#include <stdint.h>
     22
     23#include <rtems/stringto.h>
     24
    1625/*
    17  *  Instantiate an error checking wrapper for strtoul which is
    18  *  used to input a (void *)
    19  *
    20  *  NOTE: This is only an appropriate implementation when unsigned long
    21  *        can represent a void *
     26 *  Instantiate an error checking wrapper for strtoul/strtoull (void *)
    2227 */
    23 #define STRING_TO_POINTER
    24 #define STRING_TO_TYPE void *
    25 #define STRING_TO_INPUT_TYPE unsigned long
    26 #define STRING_TO_NAME rtems_string_to_pointer
    27 #define STRING_TO_METHOD strtoul
    28 #define STRING_TO_MAX ULONG_MAX
    29 #include "stringto_template.h"
     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 TracChangeset for help on using the changeset viewer.