tor

The Tor anonymity network
git clone https://git.dasho.dev/tor.git
Log | Files | Refs | README | LICENSE

ptr_helpers.c (796B)


      1 /* Copyright (c) 2001-2004, Roger Dingledine.
      2 * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
      3 * Copyright (c) 2007-2021, The Tor Project, Inc. */
      4 /* See LICENSE for licensing information */
      5 
      6 #include "test/ptr_helpers.h"
      7 
      8 /**
      9 * Cast <b> (inptr_t value) to a void pointer.
     10 */
     11 void *
     12 cast_intptr_to_voidstar(intptr_t x)
     13 {
     14  void *r = (void *)x;
     15 
     16  return r;
     17 }
     18 
     19 /**
     20 * Cast x (void pointer) to inptr_t value.
     21 */
     22 intptr_t
     23 cast_voidstar_to_intptr(void *x)
     24 {
     25  intptr_t r = (intptr_t)x;
     26 
     27  return r;
     28 }
     29 
     30 /**
     31 * Cast x (uinptr_t value) to void pointer.
     32 */
     33 void *
     34 cast_uintptr_to_voidstar(uintptr_t x)
     35 {
     36  void *r = (void *)x;
     37 
     38  return r;
     39 }
     40 
     41 /**
     42 * Cast x (void pointer) to uinptr_t value.
     43 */
     44 uintptr_t
     45 cast_voidstar_to_uintptr(void *x)
     46 {
     47  uintptr_t r = (uintptr_t)x;
     48 
     49  return r;
     50 }