File: coverity-model.c

package info (click to toggle)
mutter 49.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 51,732 kB
  • sloc: ansic: 397,916; xml: 3,384; python: 3,270; sh: 389; ruby: 167; makefile: 61; javascript: 26
file content (80 lines) | stat: -rw-r--r-- 2,061 bytes parent folder | download
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
/* This is the source code of our Coverity model. Meant to enhance
 * the accuracy of reports, improve understanding of the existing
 * code, or avoid false positives.
 *
 * This is not a real C file, and can not use #include directives.
 * These are basically hints about the function behavior, in a way
 * that Coverity can understand.
 *
 * The model file must be uploaded manually by someone with
 * access permission to the Mutter console at
 * https://scan.coverity.com/projects/mutter.
 */

#define NULL ((void *) 0)
#define FALSE 0
#define TRUE !FALSE

typedef unsigned int gboolean;
typedef void* gpointer;
typedef struct _GObject { int ref_count; } GObject;
typedef struct _GSource { int ref_count; } GSource;
typedef struct _GMainContext { int ref_count; } GMainContext;
typedef struct _GFile { GObject parent } GFile;
typedef struct _GCancellable { GObject parent } GCancellable;
typedef struct _GAsyncResult { GObject parent } GAsyncResult;

typedef void (*GAsyncReadyCallback) (GObject      *object,
                                     GAsyncResult *res,
                                     gpointer      user_data);

GSource *
g_source_ref (GSource *source)
{
  source->ref_count++;
}

void
g_source_attach (GSource      *source,
                 GMainContext *context)
{
  source->ref_count++;
}

void
g_source_unref (GSource *source)
{
  source->ref_count--;

  if (source->ref_count <= 0)
    __coverity_free__ (source);
}

GObject *
g_object_ref (GObject *object)
{
  object->ref_count++;
}

void
g_object_unref (GObject *object)
{
  object->ref_count--;

  if (object->ref_count <= 0)
    __coverity_free__ (object);
}

void
g_file_replace_contents_async (GFile               *file,
			       const char          *contents,
			       size_t               len,
			       const char          *etag,
			       gboolean             make_backup,
			       unsigned int         flags,
			       GCancellable        *cancellable,
			       GAsyncReadyCallback  cb,
			       gpointer             user_data)
{
  __coverity_escape__ (user_data);
}