1 | |
|
|
2 | /* |
|
|
3 | * static char *rcsid_utils_c = |
|
|
4 | * "$Id: utils.C,v 1.12 2006/09/12 20:55:40 root Exp $"; |
|
|
5 | */ |
|
|
6 | |
|
|
7 | /* |
1 | /* |
8 | CrossFire, A Multiplayer game for X-windows |
2 | CrossFire, A Multiplayer game for X-windows |
9 | |
3 | |
10 | Copyright (C) 2002 Mark Wedel & Crossfire Development Team |
4 | Copyright (C) 2002 Mark Wedel & Crossfire Development Team |
11 | Copyright (C) 1992 Frank Tore Johansen |
5 | Copyright (C) 1992 Frank Tore Johansen |
… | |
… | |
551 | return; |
545 | return; |
552 | } |
546 | } |
553 | |
547 | |
554 | void *alloc (int s) throw (std::bad_alloc) |
548 | void *alloc (int s) throw (std::bad_alloc) |
555 | { |
549 | { |
|
|
550 | void *p = g_slice_alloc (s); |
|
|
551 | |
556 | if (s) |
552 | if (!p) |
557 | return g_slice_alloc (s); |
553 | throw std::bad_alloc (); |
558 | else |
554 | |
559 | return 0; |
555 | return p; |
560 | } |
|
|
561 | |
|
|
562 | void dealloc (void *p, int s) throw () |
|
|
563 | { |
|
|
564 | if (s) |
|
|
565 | g_slice_free1 (s, p); |
|
|
566 | } |
556 | } |
567 | |
557 | |
568 | void assign (char *dst, const char *src, int maxlen) |
558 | void assign (char *dst, const char *src, int maxlen) |
569 | { |
559 | { |
570 | if (!src) |
560 | if (!src) |