Utility functions for weak references and pointers.
More...
#include <config.h>
#include "libgeda_priv.h"
Go to the source code of this file.
Data Structures |
struct | WeakRef |
Functions |
void | s_weakref_notify (void *dead_ptr, GList *weak_refs) |
| Notify weak reference watchers that a structure is dead.
|
GList * | s_weakref_add (GList *weak_refs, void(*notify_func)(void *, void *), void *user_data) |
| Add a weak reference watcher to a weak ref list.
|
GList * | s_weakref_remove (GList *weak_refs, void(*notify_func)(void *, void *), void *user_data) |
| Remove a weak reference watcher from a weak ref list.
|
static void | weak_ptr_notify_func (void *dead_ptr, void *user_data) |
GList * | s_weakref_add_ptr (GList *weak_refs, void **weak_pointer_loc) |
| Add a weak pointer to a weak ref list.
|
GList * | s_weakref_remove_ptr (GList *weak_refs, void **weak_pointer_loc) |
| Remove a weak pointer from a weak ref list.
|
Detailed Description
- Warning:
- Do not write code which relies on the order in which weak reference callback functions are notified.
Definition in file s_weakref.c.
Function Documentation
void s_weakref_notify |
( |
void * |
dead_ptr, |
|
|
GList * |
weak_refs |
|
) |
| |
- Function Description
- For each entry in weak_refs, call notify function with the dead pointer dead_ptr and the entry's specified user data, and free weak_refs. Should be called during destruction of an structure that allows weak references.
- Parameters:
-
[in] | dead_ptr | Pointer to structure being destroyed. |
[in,out] | weak_refs | List of registered weak references. |
Definition at line 48 of file s_weakref.c.
GList* s_weakref_add |
( |
GList * |
weak_refs, |
|
|
void(*)(void *, void *) |
notify_func, |
|
|
void * |
user_data |
|
) |
| |
- Function Description
- Adds the weak reference callback notify_func to the weak reference list weak_refs, returning the new head of weak_refs. notify_func will be called with two arguments: a pointer to the object being destroyed, and the user_data.
- Parameters:
-
[in,out] | weak_refs | List of registered weak references. |
[in] | notify_func | Weak reference notify function. |
[in] | user_data | Data to be passed to notify_func. |
- Returns:
- new head of weak_refs list.
Definition at line 76 of file s_weakref.c.
GList* s_weakref_remove |
( |
GList * |
weak_refs, |
|
|
void(*)(void *, void *) |
notify_func, |
|
|
void * |
user_data |
|
) |
| |
- Function Description
- Removes a weak reference callback from the weak reference list weak_refs, returning the new head of weak_refs.
- Parameters:
-
[in,out] | weak_refs | List of registered weak references. |
[in] | notify_func | Notify function to search for. |
[in] | user_data | User data to search for. |
- Returns:
- new head of weak_refs list.
Definition at line 97 of file s_weakref.c.
static void weak_ptr_notify_func |
( |
void * |
dead_ptr, |
|
|
void * |
user_data |
|
) |
| [static] |
GList* s_weakref_add_ptr |
( |
GList * |
weak_refs, |
|
|
void ** |
weak_pointer_loc |
|
) |
| |
- Function Description
- Adds a weak reference for weak_pointer_loc to the weak reference list weak_refs, returning the new head of weak_refs.
- Parameters:
-
[in,out] | weak_refs | List of registered weak references. |
[in] | weak_pointer_loc | Memory address of a pointer. |
- Returns:
- new head of weak_refs list.
Definition at line 133 of file s_weakref.c.
GList* s_weakref_remove_ptr |
( |
GList * |
weak_refs, |
|
|
void ** |
weak_pointer_loc |
|
) |
| |
- Function Description
- Removes the weak reference for weak_pointer_loc from the weak reference list weak_refs, returning the new head of weak_refs.
- Parameters:
-
[in,out] | weak_refs | List of registered weak references. |
[in] | weak_pointer_loc | Memory address of a pointer. |
- Returns:
- new head of weak_refs list.
Definition at line 150 of file s_weakref.c.