summaryrefslogtreecommitdiff
path: root/glib/grcboxprivate.h
blob: 6599e4d4a072b9a11c1b203936783b46455d3788 (plain)
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
#pragma once

#include "gtypes.h"

G_BEGIN_DECLS

typedef struct {
  grefcount ref_count;

  gsize mem_size;

#ifndef G_DISABLE_ASSERT
  /* A "magic" number, used to perform additional integrity
   * checks on the allocated data
   */
  guint32 magic;
#endif
} GRcBox;

typedef struct {
  gatomicrefcount ref_count;

  gsize mem_size;

#ifndef G_DISABLE_ASSERT
  guint32 magic;
#endif
} GArcBox;

#define G_BOX_MAGIC             0x44ae2bf0

/* Keep the two refcounted boxes identical in size */
G_STATIC_ASSERT (sizeof (GRcBox) == sizeof (GArcBox));

#define G_RC_BOX_SIZE sizeof (GRcBox)
#define G_ARC_BOX_SIZE sizeof (GArcBox)

gpointer        g_rc_box_alloc_full     (gsize    block_size,
                                         gboolean atomic,
                                         gboolean clear);

G_END_DECLS