summaryrefslogtreecommitdiff
path: root/plugins/Scriver/src/cmdlist.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2015-05-27 14:57:44 +0000
committerGeorge Hazan <george.hazan@gmail.com>2015-05-27 14:57:44 +0000
commit09cace2f7d8fdbfb047eba9a6396d79d59422443 (patch)
treecca8e0062d7403b9c6a7a87849a50a4ccd89ff9a /plugins/Scriver/src/cmdlist.cpp
parentd4feadd097aff1815404597953c3c59527b96598 (diff)
massive ansi cleaning for Scriver
git-svn-id: http://svn.miranda-ng.org/main/trunk@13860 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Scriver/src/cmdlist.cpp')
-rw-r--r--plugins/Scriver/src/cmdlist.cpp75
1 files changed, 10 insertions, 65 deletions
diff --git a/plugins/Scriver/src/cmdlist.cpp b/plugins/Scriver/src/cmdlist.cpp
index 7cbdd96b4f..29731070cc 100644
--- a/plugins/Scriver/src/cmdlist.cpp
+++ b/plugins/Scriver/src/cmdlist.cpp
@@ -23,25 +23,21 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "commonheaders.h"
-TCmdList *tcmdlist_append(TCmdList *list, const char *data, int maxSize, BOOL temporary)
+TCmdList* tcmdlist_append(TCmdList *list, char *data, int maxSize, BOOL temporary)
{
- TCmdList *new_list = (TCmdList *)mir_alloc(sizeof(TCmdList));
- TCmdList *attach_to = NULL;
-
- if (!data) {
- mir_free(new_list);
+ if (!data)
return list;
- }
+
+ TCmdList *new_list = (TCmdList *)mir_calloc(sizeof(TCmdList));
new_list->temporary = temporary;
- new_list->next = NULL;
- new_list->szCmd = mir_strdup(data);
+ new_list->szCmd = data;
+
+ TCmdList *attach_to = NULL;
for (TCmdList *n = list; n != NULL; n = n->next)
attach_to = n;
- if (attach_to == NULL) {
- new_list->prev = NULL;
+ if (attach_to == NULL)
return new_list;
- }
new_list->prev = attach_to;
attach_to->next = new_list;
@@ -50,7 +46,7 @@ TCmdList *tcmdlist_append(TCmdList *list, const char *data, int maxSize, BOOL te
return list;
}
-TCmdList *tcmdlist_remove_first(TCmdList *list)
+TCmdList* tcmdlist_remove_first(TCmdList *list)
{
TCmdList *n = list;
if (n->next) n->next->prev = n->prev;
@@ -71,57 +67,6 @@ TCmdList *tcmdlist_remove(TCmdList *list, TCmdList *n)
return list;
}
-TCmdList *tcmdlist_append2(TCmdList *list, MCONTACT hContact, const char *data)
-{
- TCmdList *new_list = (TCmdList *)mir_alloc(sizeof(TCmdList));
- TCmdList *attach_to = NULL;
-
- if (!data) {
- mir_free(new_list);
- return list;
- }
- new_list->temporary = FALSE;
- new_list->next = NULL;
- new_list->hContact = hContact;
- new_list->szCmd = mir_strdup(data);
- list = tcmdlist_remove2(list, hContact);
- for (TCmdList *n = list; n != NULL; n = n->next)
- attach_to = n;
-
- if (attach_to == NULL) {
- new_list->prev = NULL;
- return new_list;
- }
-
- new_list->prev = attach_to;
- attach_to->next = new_list;
- return list;
-}
-
-TCmdList *tcmdlist_remove2(TCmdList *list, MCONTACT hContact)
-{
- for (TCmdList *n = list; n != NULL; n = n->next) {
- if (n->hContact == hContact) {
- if (n->next) n->next->prev = n->prev;
- if (n->prev) n->prev->next = n->next;
- if (n == list) list = n->next;
- mir_free(n->szCmd);
- mir_free(n);
- return list;
- }
- }
- return list;
-}
-
-TCmdList *tcmdlist_get2(TCmdList *list, MCONTACT hContact)
-{
- for (TCmdList *n = list; n != NULL; n = n->next)
- if (n->hContact == hContact)
- return n;
-
- return NULL;
-}
-
int tcmdlist_len(TCmdList *list)
{
int i = 0;
@@ -131,7 +76,7 @@ int tcmdlist_len(TCmdList *list)
return i;
}
-TCmdList *tcmdlist_last(TCmdList *list)
+TCmdList* tcmdlist_last(TCmdList *list)
{
for (TCmdList *n = list; n != NULL; n = n->next)
if (!n->next)