ftp.nice.ch/pub/next/unix/audio/shorten.1.12.s.tar.gz#/shorten-1.12/array.c

This is array.c in view mode; [Download] [Up]

/******************************************************************************
*                                                                             *
*       Copyright (C) 1992,1993,1994 Tony Robinson                            *
*                                                                             *
*       See the file LICENSE for conditions on distribution and usage         *
*                                                                             *
******************************************************************************/

# include <stdio.h>
# include "shorten.h"

void *pmalloc(size) ulong size; {
  void *ptr;

  ptr = malloc(size);

  if(ptr == NULL)
    perror_exit("malloc(%d)", size);

  return(ptr);
}

long **long2d(n0, n1) ulong n0, n1; {
  long **array0;

  if((array0 = (long**)pmalloc(n0 * sizeof(long*) +n0*n1*sizeof(long)))!=NULL){
    long *array1 = (long*) (array0 + n0);
    int i;
    
    for(i = 0; i < n0; i++)
      array0[i] = array1 + i * n1;
  }
  return(array0);
}

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.