|
||||
File indexing completed on 2018-03-02 18:45:02 UTC
view on githubraw file Latest commit e768bd12 on 2008-02-26 17:05:00 UTCec6cf3b09d Ed H*0001 /* (C) Copyright 1993,1994 by Carnegie Mellon University 0002 * All Rights Reserved. 0003 * 0004 * Permission to use, copy, modify, distribute, and sell this software 0005 * and its documentation for any purpose is hereby granted without 0006 * fee, provided that the above copyright notice appear in all copies 0007 * and that both that copyright notice and this permission notice 0008 * appear in supporting documentation, and that the name of Carnegie 0009 * Mellon University not be used in advertising or publicity 0010 * pertaining to distribution of the software without specific, 0011 * written prior permission. Carnegie Mellon University makes no 0012 * representations about the suitability of this software for any 0013 * purpose. It is provided "as is" without express or implied 0014 * warranty. 0015 * 0016 * CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO 0017 * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 0018 * AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE 0019 * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 0020 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN 0021 * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING 0022 * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS 0023 * SOFTWARE. 0024 */ 0025 #include <stdio.h> e768bd1221 Jean*0026 #include <stdlib.h> ec6cf3b09d Ed H*0027 #include <string.h> 0028 0029 char *xmalloc (int size) 0030 { 0031 char *ret; 0032 e768bd1221 Jean*0033 if ((ret = malloc((unsigned) size))) ec6cf3b09d Ed H*0034 return ret; 0035 0036 fprintf(stderr, "Memory exhausted\n"); 0037 exit(1); 0038 } 0039 0040 0041 char *xrealloc (char *ptr, int size) 0042 { 0043 char *ret; 0044 0045 /* xrealloc (NULL, size) behaves like xmalloc (size), as in ANSI C */ e768bd1221 Jean*0046 if ((ret = !ptr ? malloc ((unsigned) size) : realloc (ptr, (unsigned) size))) ec6cf3b09d Ed H*0047 return ret; 0048 0049 fprintf(stderr, "Memory exhausted\n"); 0050 exit(1); 0051 } 0052 0053 char *strsave(char *str) 0054 { 0055 char *p = xmalloc(strlen(str)+1); 0056 strcpy(p, str); 0057 return p; 0058 }
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated from https://github.com/MITgcm/MITgcm by the 2.2.1-MITgcm-0.1 LXR engine. The LXR team |