1 | /* $Id$ $Revision$ */ |
2 | /* vim:set shiftwidth=4 ts=8: */ |
3 | |
4 | /************************************************************************* |
5 | * Copyright (c) 2011 AT&T Intellectual Property |
6 | * All rights reserved. This program and the accompanying materials |
7 | * are made available under the terms of the Eclipse Public License v1.0 |
8 | * which accompanies this distribution, and is available at |
9 | * http://www.eclipse.org/legal/epl-v10.html |
10 | * |
11 | * Contributors: See CVS logs. Details at http://www.graphviz.org/ |
12 | *************************************************************************/ |
13 | |
14 | #include "vmhdr.h" |
15 | |
16 | /* Change the discipline for a region. The old discipline |
17 | ** is returned. If the new discipline is NIL then the |
18 | ** discipline is not changed. |
19 | ** |
20 | ** Written by Kiem-Phong Vo, kpv@research.att.com, 01/16/94. |
21 | */ |
22 | Vmdisc_t *vmdisc(Vmalloc_t * vm, Vmdisc_t * disc) |
23 | { |
24 | Vmdisc_t *old = vm->disc; |
25 | |
26 | if (disc) { |
27 | if (disc->memoryf != old->memoryf) |
28 | return NIL(Vmdisc_t *); |
29 | if (old->exceptf && |
30 | (*old->exceptf) (vm, VM_DISC, (void *) disc, old) != 0) |
31 | return NIL(Vmdisc_t *); |
32 | vm->disc = disc; |
33 | } |
34 | return old; |
35 | } |
36 | |