author | Medo <smaxein@googlemail.com> |
Mon, 25 Jun 2012 00:42:07 +0200 | |
changeset 7271 | 5608ac657362 |
parent 7230 | 240620f46dd7 |
child 7314 | 6171f0bad318 |
permissions | -rw-r--r-- |
7230
240620f46dd7
Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
1 |
/** |
240620f46dd7
Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
2 |
* Helper functions for reference counted structs. |
240620f46dd7
Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
3 |
* |
240620f46dd7
Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
4 |
* We don't have enough of them to justify going crazy with macros, but I still prefer |
240620f46dd7
Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
5 |
* to have the logic in one place. |
240620f46dd7
Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
6 |
* |
240620f46dd7
Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
7 |
* In particular, these functions handle counter overflow in a sensible way |
240620f46dd7
Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
8 |
* (log and leak). |
240620f46dd7
Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
9 |
*/ |
240620f46dd7
Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
10 |
|
240620f46dd7
Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
11 |
#ifndef REFCOUNTER_H_ |
240620f46dd7
Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
12 |
#define REFCOUNTER_H_ |
240620f46dd7
Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
13 |
|
240620f46dd7
Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
14 |
#include <stdbool.h> |
240620f46dd7
Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
15 |
|
240620f46dd7
Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
16 |
/** |
7271
5608ac657362
frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents:
7230
diff
changeset
|
17 |
* Pass a pointer to the counter variable to be incremented, and the name of the |
5608ac657362
frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents:
7230
diff
changeset
|
18 |
* object for logging purposes. On overflow an error will be logged and the |
5608ac657362
frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents:
7230
diff
changeset
|
19 |
* counter will get "stuck" so neither retain nor release will modify it anymore. |
7230
240620f46dd7
Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
20 |
*/ |
7271
5608ac657362
frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents:
7230
diff
changeset
|
21 |
void flib_retain(int *referenceCountPtr, const char *objName); |
5608ac657362
frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents:
7230
diff
changeset
|
22 |
|
5608ac657362
frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents:
7230
diff
changeset
|
23 |
/** |
5608ac657362
frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents:
7230
diff
changeset
|
24 |
* Pass a pointer to the counter variable to be decremented and the name |
5608ac657362
frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents:
7230
diff
changeset
|
25 |
* of the object for logging purposes. |
5608ac657362
frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents:
7230
diff
changeset
|
26 |
* Returns true if the object should be freed. |
5608ac657362
frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents:
7230
diff
changeset
|
27 |
*/ |
5608ac657362
frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents:
7230
diff
changeset
|
28 |
bool flib_release(int *referenceCountPtr, const char *objName); |
7230
240620f46dd7
Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
29 |
|
240620f46dd7
Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents:
diff
changeset
|
30 |
#endif /* REFCOUNTER_H_ */ |