github.com/astrogo/cfitsio@v0.1.0/go-cfitsio-utils.h (about)

     1  #ifndef GO_CFITSIO_UTILS_H
     2  #define GO_CFITSIO_UTILS_H 1
     3  
     4  #include <stdlib.h>
     5  #include <string.h>
     6  
     7  static
     8  char* 
     9  CStringN(int sz) 
    10  {
    11   char* array = (char*)malloc(sz*sizeof(char));
    12   return array;
    13  }
    14  
    15  static
    16  char**
    17  char_array_new(int sz)
    18  {
    19    int i = 0;
    20    char **array = (char**)malloc(sz*sizeof(char*));
    21    for (i = 0; i < sz; i++) {
    22      array[i] = NULL;
    23    }
    24    return array;
    25  }
    26  
    27  static
    28  void
    29  char_array_set(char** array, int idx, char *value)
    30  {
    31    array[idx] = value;
    32  }
    33  
    34  static
    35  long*
    36  long_array_new(int sz)
    37  {
    38    long *array = (long*)malloc(sz*sizeof(long));
    39    return array;
    40  }
    41  
    42  #endif /* !GO_CFITSIO_UTILS_H */