Add setptr() macro to free data and reassign to the same pointer.
git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@1567 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
parent
5331b0ada0
commit
b7e499529d
@ -1,3 +1,9 @@
|
|||||||
|
2007-05-24 Nick Treleaven <nick.treleaven@btinternet.com>
|
||||||
|
|
||||||
|
* src/utils.h:
|
||||||
|
Add setptr() macro to free data and reassign to the same pointer.
|
||||||
|
|
||||||
|
|
||||||
2007-05-24 Enrico Tröger <enrico.troeger@uvena.de>
|
2007-05-24 Enrico Tröger <enrico.troeger@uvena.de>
|
||||||
|
|
||||||
* src/document.c: Fix loading of UTF-16/32 encoded files with a BOM.
|
* src/document.c: Fix loading of UTF-16/32 encoded files with a BOM.
|
||||||
|
|||||||
10
src/utils.h
10
src/utils.h
@ -29,6 +29,16 @@
|
|||||||
#define NZV(ptr) \
|
#define NZV(ptr) \
|
||||||
((ptr) && (ptr)[0])
|
((ptr) && (ptr)[0])
|
||||||
|
|
||||||
|
/* Free's ptr (if not NULL), then assigns result to it.
|
||||||
|
* result can be an expression using the 'old' value of ptr.
|
||||||
|
* It prevents a memory leak compared with: ptr = func(ptr); */
|
||||||
|
#define setptr(ptr, result)\
|
||||||
|
{\
|
||||||
|
gpointer tmp = ptr;\
|
||||||
|
ptr = result;\
|
||||||
|
g_free(tmp);\
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void utils_start_browser(const gchar *uri);
|
void utils_start_browser(const gchar *uri);
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user