Main Page | Modules | Data Structures | File List | Data Fields

Miscellaneous
[State Utility Library]


Defines

#define BREAKPOINT()   { __asm__ __volatile__ ("int $03"); }
#define SUL_ASSERT(expr, msg)
#define ASSERT(expr, msg)   SUL_ASSERT((expr), msg)
#define ASSERTN(expr)   SUL_ASSERT((expr), NULL)
#define SUL_VERIFY0(expr, msg)
#define SUL_VERIFY1(expr, msg, a1)
#define SUL_VERIFY2(expr, msg, a1, a2)
#define SUL_VERIFY3(expr, msg, a1, a2, a3)
#define SUL_VERIFY4(expr, msg, a1, a2, a3, a4)
#define APR_ARRAY_IDX(ary, i, type)   (((type *)(ary)->elts)[i])
#define APR_ARRAY_SIZE(array)   ((array)->nelts)
#define APR_ARRAY_TOP(array, type)   APR_ARRAY_IDX(array, APR_ARRAY_SIZE(array) - 1, type)
#define APR_PCALLOC_TYPE(pool, type)   (type *)apr_pcalloc(pool, sizeof(type))
#define APR_PALLOC_TYPE(pool, type)   (type *)apr_palloc(pool, sizeof(type))
#define APR_ARRAY_INTS_CREATE(pool)   apr_array_make(pool, 1, sizeof(apr_int32_t))
#define APR_ARRAY_INTS_PUSH(arr, value)   *((apr_int32_t *)apr_array_push((arr))) = (value)
#define APR_ARRAY_STRS_CREATE(pool)   apr_array_make(pool, 1, sizeof(const char *))
#define APR_ARRAY_STRS_PUSH(arr, value)   *((const char **)apr_array_push((arr))) = (value)
#define sul_memzero(ptr, sz)   ((void)memset(ptr, 0, sz))

Typedefs

typedef apr_int32_t fd_t
typedef apr_int16_t sul_boolean_t
typedef apr_status_t sul_status_t

Functions

 sul_error_log_assertion (const char *expr_str, const char *msg, const char *func, const char *file, apr_ssize_t line)
 sul_path_basename (const char *path, apr_pool_t *pool)
 sul_path_basepath (const char *path, apr_pool_t *pool)

Define Documentation

#define APR_ARRAY_IDX ary,
i,
type   )     (((type *)(ary)->elts)[i])
 

Returns the item at the given index in an APR array.

Parameters:
ary Array to get the the item from.
i Index into the array.
type Type of the objects being stored in the array.

#define APR_ARRAY_INTS_CREATE pool   )     apr_array_make(pool, 1, sizeof(apr_int32_t))
 

Creates an array suitable for storing string pointers and string pointers only.

Parameters:
pool Pool to allocate from.
See also:
APR_ARRAY_STRS_PUSH

#define APR_ARRAY_INTS_PUSH arr,
value   )     *((apr_int32_t *)apr_array_push((arr))) = (value)
 

Pushes a new string into a string only array.

Parameters:
arr Array of strings.
value String to be pushed into the String array.
See also:
APR_ARRAY_STRS_CREATE

#define APR_ARRAY_SIZE array   )     ((array)->nelts)
 

Returns the size of an APR array.

Parameters:
array Array to get the size of.

#define APR_ARRAY_STRS_CREATE pool   )     apr_array_make(pool, 1, sizeof(const char *))
 

Creates an array suitable for storing string pointers and string pointers only.

Parameters:
pool Pool to allocate from.
See also:
APR_ARRAY_STRS_PUSH

#define APR_ARRAY_STRS_PUSH arr,
value   )     *((const char **)apr_array_push((arr))) = (value)
 

Pushes a new string into a string only array.

Parameters:
arr Array of strings.
value String to be pushed into the String array.
See also:
APR_ARRAY_STRS_CREATE

#define APR_ARRAY_TOP array,
type   )     APR_ARRAY_IDX(array, APR_ARRAY_SIZE(array) - 1, type)
 

Returns the item at the top of the array (item SIZE - 1)

Parameters:
array Array to get the the item from.
type Type of the objects being stored in the array.

#define APR_PALLOC_TYPE pool,
type   )     (type *)apr_palloc(pool, sizeof(type))
 

Allocates a block of memory that is sizeof(type) in length and returns a pointer to type.

Parameters:
pool Pool to allocate from.
type Type to allocate.

#define APR_PCALLOC_TYPE pool,
type   )     (type *)apr_pcalloc(pool, sizeof(type))
 

Allocates a block of memory that is sizeof(type) in length and returns a pointer to type.

Parameters:
pool Pool to allocate from.
type Type to allocate.

#define ASSERT expr,
msg   )     SUL_ASSERT((expr), msg)
 

Asserts the truth of the given expression during runtime.

#define ASSERTN expr   )     SUL_ASSERT((expr), NULL)
 

Asserts the truth of the given expression during runtime.

#define SUL_ASSERT expr,
msg   ) 
 

Value:

do { \
    if (!(expr)) { \
      sul_error_log_assertion(#expr, msg, __FUNCTION__, __FILE__, __LINE__); \
      abort(); \
    } \
  } \
  while (0)

#define sul_memzero ptr,
sz   )     ((void)memset(ptr, 0, sz))
 

Fills a region of memory with zeros.

Parameters:
ptr Pointer to the region of memory.
sz Size, in bytes, of the region of memory.

#define SUL_VERIFY0 expr,
msg   ) 
 

Value:

do { \
    if (!(expr)) { \
      return (sul_error_create(0, 0, NULL, #expr " failed: " msg)); \
    } \
  } while (0)
Quick and easy macro for testing and then returning an error on failure.

#define SUL_VERIFY1 expr,
msg,
a1   ) 
 

Value:

do { \
    if (!(expr)) { \
      return (sul_error_create(0, 0, NULL, #expr " failed: " msg, a1)); \
    } \
  } while (0)

#define SUL_VERIFY2 expr,
msg,
a1,
a2   ) 
 

Value:

do { \
    if (!(expr)) { \
      return (sul_error_create(0, 0, NULL, #expr " failed: " msg, a1, a2)); \
    } \
  } while (0)

#define SUL_VERIFY3 expr,
msg,
a1,
a2,
a3   ) 
 

Value:

do { \
    if (!(expr)) { \
      return (sul_error_create(0, 0, NULL, #expr " failed: " msg, a1, a2, a3)); \
    } \
  } while (0)

#define SUL_VERIFY4 expr,
msg,
a1,
a2,
a3,
a4   ) 
 

Value:

do { \
    if (!(expr)) { \
      return (sul_error_create(0, 0, NULL, #expr " failed: " msg, a1, a2, a3, a4)); \
    } \
  } while (0)


Typedef Documentation

typedef apr_int32_t fd_t
 

File descriptor type.

typedef apr_int16_t sul_boolean_t
 

Boolean type.

typedef apr_status_t sul_status_t
 

Status type.


Function Documentation

sul_error_log_assertion const char *  expr_str,
const char *  msg,
const char *  func,
const char *  file,
apr_ssize_t  line
 

Logs an assertion failure to the log file and then aborts the application.

Parameters:
expr_str The assertion that failed.
msg A descriptive message describing the fault.
func The function that the assertion failed in.
file The file the assertion is in.
line The line the assertion is defined on.

sul_path_basename const char *  path,
apr_pool_t *  pool
 

Returns the base file name of the given path. For example if the path is /dev/hda3 then it will return hda3.

Parameters:
path Path to parse the base name from.
pool Pool to allocate the memory from.
Returns:
A pointer to the base name.

sul_path_basepath const char *  path,
apr_pool_t *  pool
 

Parses the base path of a given path, returning /home/systems if you pass in /home/systems/jlewalle.

Parameters:
path Path to parse the base path from.
pool Pool to allocate the memory from.
Returns:
A pointer to the base path.


Generated on Wed Apr 28 09:38:38 2004 for State by doxygen 1.3.5