diff options
author | Vadim Dashevskiy <watcherhd@gmail.com> | 2012-05-19 11:12:34 +0000 |
---|---|---|
committer | Vadim Dashevskiy <watcherhd@gmail.com> | 2012-05-19 11:12:34 +0000 |
commit | 927add1b301c9f38808f3d35854d3ce896bff095 (patch) | |
tree | 244dfff95aee5393ec835e5804252ff8cf07866d /plugins/updater/allocations.h | |
parent | e447995b61b645d48ebe837a0ee4fdb28373aa1c (diff) |
adding SpellChecker plugin
git-svn-id: http://svn.miranda-ng.org/main/trunk@69 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/updater/allocations.h')
-rw-r--r-- | plugins/updater/allocations.h | 72 |
1 files changed, 0 insertions, 72 deletions
diff --git a/plugins/updater/allocations.h b/plugins/updater/allocations.h deleted file mode 100644 index 842d7daf01..0000000000 --- a/plugins/updater/allocations.h +++ /dev/null @@ -1,72 +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;
-}
-
-#ifdef _UNICODE
-#define safe_tstrdup(x) safe_wstrdup(x)
-#else
-#define sage_tstrdup(x) safe_strdup(x)
-#endif
-
-__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
|