LIBFMSR  0.1
Defines | Typedefs | Functions
misc.h File Reference

Contains prototypes for functions implemented in misc.c. More...

#include <errno.h>
#include <stdio.h>
#include <stdlib.h>

Go to the source code of this file.

Defines

#define show_error(call)
 Print error details with perror() and exit.
#define show_pthread_error(call, errnum)
 Print pthread_related error details and exit.
#define safe_talloc(type, num)   (type *)safe_malloc(sizeof(type)*(num))
 malloc() with error-handling
#define LIBFMSR_GF

Typedefs

typedef unsigned char gf

Functions

void * safe_malloc (size_t size)
void print_matrix (gf *A, gf n, gf m)
 print an n x m matrix A for debug use

Detailed Description

Contains prototypes for functions implemented in misc.c.

Author:
Henry Chen (chchen@cse.cuhk.edu.hk)

Define Documentation

#define LIBFMSR_GF
#define safe_talloc (   type,
  num 
)    (type *)safe_malloc(sizeof(type)*(num))

malloc() with error-handling

#define show_error (   call)
Value:
do { \
    fprintf(stderr, "%c[1;31;40m", 0x1B); \
    fprintf(stderr, "%s(%d) in %s:: ", __FILE__, __LINE__, __func__); \
    perror(call); \
    fprintf(stderr, "%c[0m", 0x1B); \
    exit(-1); } while (0)

Print error details with perror() and exit.

#define show_pthread_error (   call,
  errnum 
)
Value:
do { \
    fprintf(stderr, "%c[1;31;40m", 0x1B); \
    fprintf(stderr, "%s(%d) in %s:: ", __FILE__, __LINE__, __func__); \
    errno = errnum; \
    perror(call); \
    fprintf(stderr, "%c[0m", 0x1B); \
    exit(-1); } while (0)

Print pthread_related error details and exit.


Typedef Documentation

typedef unsigned char gf

Function Documentation

void print_matrix ( gf A,
gf  n,
gf  m 
)

print an n x m matrix A for debug use

void* safe_malloc ( size_t  size)
 All Data Structures Files Functions Variables Typedefs Defines