File: stubborn.c

package info (click to toggle)
libgc 1:7.6.4-0.4
  • links: PTS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 4,956 kB
  • sloc: ansic: 35,613; sh: 4,193; cpp: 1,247; makefile: 163; asm: 99
file content (56 lines) | stat: -rw-r--r-- 1,658 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/*
 * Copyright 1988, 1989 Hans-J. Boehm, Alan J. Demers
 * Copyright (c) 1991-1994 by Xerox Corporation.  All rights reserved.
 *
 * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
 * OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
 *
 * Permission is hereby granted to use or copy this program
 * for any purpose,  provided the above notices are retained on all copies.
 * Permission to modify the code and to distribute modified code is granted,
 * provided the above notices are retained, and a notice that the code was
 * modified is included with the above copyright notice.
 */

#include "private/gc_priv.h"

#if defined(MANUAL_VDB)

  /* Stubborn object (hard to change, nearly immutable) allocation.     */
  /* This interface is deprecated.  We mostly emulate it using          */
  /* MANUAL_VDB.  But that imposes the additional constraint that       */
  /* written, but not yet GC_dirty()ed objects must be referenced       */
  /* by a stack.                                                        */

  void GC_dirty(ptr_t p);

  GC_API GC_ATTR_MALLOC void * GC_CALL GC_malloc_stubborn(size_t lb)
  {
    return(GC_malloc(lb));
  }

  GC_API void GC_CALL GC_end_stubborn_change(const void *p)
  {
    GC_dirty((ptr_t)p);
  }

  GC_API void GC_CALL GC_change_stubborn(const void *p GC_ATTR_UNUSED)
  {
  }

#else /* !MANUAL_VDB */

  GC_API GC_ATTR_MALLOC void * GC_CALL GC_malloc_stubborn(size_t lb)
  {
    return(GC_malloc(lb));
  }

  GC_API void GC_CALL GC_end_stubborn_change(const void *p GC_ATTR_UNUSED)
  {
  }

  GC_API void GC_CALL GC_change_stubborn(const void *p GC_ATTR_UNUSED)
  {
  }

#endif /* !MANUAL_VDB */