Code Cleanup: style and redundant casts
[blender.git] / source / blender / blenkernel / intern / suggestions.c
index ff9774f85afc7ff7316a3b584ee512c67e86d935..d46fa591885f2481a582c9094f1c8bf1c89188ec 100644 (file)
@@ -52,7 +52,7 @@ static int txttl_cmp(const char *first, const char *second, int len)
 {
        int cmp, i;
        for (cmp = 0, i = 0; i < len; i++) {
-               if ( (cmp = toupper(first[i]) - toupper(second[i])) ) {
+               if ((cmp = toupper(first[i]) - toupper(second[i]))) {
                        break;
                }
        }
@@ -163,13 +163,13 @@ void texttool_suggest_add(const char *name, char type)
        suggestions.top = 0;
 }
 
-void texttool_suggest_prefix(const char *prefix)
+void texttool_suggest_prefix(const char *prefix, const int prefix_len)
 {
        SuggItem *match, *first, *last;
-       int cmp, len = strlen(prefix), top = 0;
+       int cmp, top = 0;
 
        if (!suggestions.first) return;
-       if (len == 0) {
+       if (prefix_len == 0) {
                suggestions.selected = suggestions.firstmatch = suggestions.first;
                suggestions.lastmatch = suggestions.last;
                return;
@@ -177,7 +177,7 @@ void texttool_suggest_prefix(const char *prefix)
        
        first = last = NULL;
        for (match = suggestions.first; match; match = match->next) {
-               cmp = txttl_cmp(prefix, match->name, len);
+               cmp = txttl_cmp(prefix, match->name, prefix_len);
                if (cmp == 0) {
                        if (!first) {
                                first = match;