Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/blenkernel/intern/suggestions.c')
-rw-r--r--source/blender/blenkernel/intern/suggestions.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/source/blender/blenkernel/intern/suggestions.c b/source/blender/blenkernel/intern/suggestions.c
index 99e33594a3e..ff9774f85af 100644
--- a/source/blender/blenkernel/intern/suggestions.c
+++ b/source/blender/blenkernel/intern/suggestions.c
@@ -47,6 +47,7 @@ static SuggList suggestions = {NULL, NULL, NULL, NULL, NULL};
static char *documentation = NULL;
//static int doc_lines = 0;
+/* TODO, replace with BLI_strncasecmp() */
static int txttl_cmp(const char *first, const char *second, int len)
{
int cmp, i;
@@ -113,19 +114,18 @@ short texttool_text_is_active(Text *text)
void texttool_suggest_add(const char *name, char type)
{
+ const int len = strlen(name);
+ int cmp;
SuggItem *newitem, *item;
- int len, cmp;
- newitem = MEM_mallocN(sizeof(SuggItem) + strlen(name) + 1, "SuggestionItem");
+ newitem = MEM_mallocN(sizeof(SuggItem) + len + 1, "SuggItem");
if (!newitem) {
printf("Failed to allocate memory for suggestion.\n");
return;
}
newitem->name = (char *) (newitem + 1);
- len = strlen(name);
- strncpy(newitem->name, name, len);
- newitem->name[len] = '\0';
+ memcpy(newitem->name, name, len + 1);
newitem->type = type;
newitem->prev = newitem->next = NULL;