summaryrefslogtreecommitdiff
path: root/plugins/Updater/allocations.h
diff options
context:
space:
mode:
authorVadim Dashevskiy <watcherhd@gmail.com>2012-07-13 21:37:56 +0000
committerVadim Dashevskiy <watcherhd@gmail.com>2012-07-13 21:37:56 +0000
commit92a701741ab376c6bd8ac20f832f55e55324abdc (patch)
treeaae30addc202f556781d3c86706a1fdef4fa953b /plugins/Updater/allocations.h
parent9f1350bd4fb0df56a4115e80343285eef8acb954 (diff)
Updater removal - stage 1
git-svn-id: http://svn.miranda-ng.org/main/trunk@956 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Updater/allocations.h')
-rw-r--r--plugins/Updater/allocations.h70
1 files changed, 0 insertions, 70 deletions
diff --git a/plugins/Updater/allocations.h b/plugins/Updater/allocations.h
deleted file mode 100644
index 25d98c21f7..0000000000
--- a/plugins/Updater/allocations.h
+++ /dev/null
@@ -1,70 +0,0 @@
-#ifndef _ALLOCATION_INC
-#define _ALLOCATION_INC
-
-// store allocated memory pointers for deallocation when shutting down
-class Allocations {
-public:
- Allocations(): head(0) {}
- virtual ~Allocations() { free_all(); }
-
- void push_back(void *pt) { Node *n = new Node; n->value = pt; n->next = head; head = n;}
-
-protected:
-
- class Node {
- public:
- void *value;
- Node *next;
- };
-
- Node *head;
-
- void free_all() {
- Node *current;
- while(head) {
- current = head;
- head = head->next;
- free(current->value);
- delete current;
- }
- }
-};
-
-extern Allocations allocations;
-
-__inline static void *safe_alloc(size_t bytes) {
- if(bytes == 0) return 0;
- void *ret = malloc(bytes);
- allocations.push_back(ret);
- return ret;
-}
-
-__inline static char *safe_strdup(const char *s) {
- if (!s) return 0;
- char *ret = _strdup(s);
- allocations.push_back(ret);
- return ret;
-}
-
-__inline static wchar_t *safe_wstrdup(const wchar_t *s) {
- if (!s) return 0;
- wchar_t *ret = _wcsdup(s);
- allocations.push_back(ret);
- return ret;
-}
-
-
-#define safe_tstrdup(x) safe_wstrdup(x)
-
-
-__inline static BYTE *safe_bytedup(BYTE *bytes, int size) {
- if (!bytes || size == 0) return 0;
-
- BYTE *ret = (BYTE *)malloc(size + 1);
- memcpy(ret, bytes, size);
- *(ret + size) = 0;
- allocations.push_back(ret);
- return ret;
-}
-
-#endif