No really bugs here.
I guess I need to re-enable smatch on my desktop
Signed-off-by: NeilBrown <neil@brown.name>
}
comm = key_lookup_cmd(m, ci->key, &key, &len);
- if (comm == NULL) {
+ if (comm == NULL || key == NULL) {
stat_count("bloom-hit-bad");
return Efallthrough;
} else {
{
int i;
int h = 0;
-for (i = 0; (len < 0 || i < len) && key[i]; i++)
+
+ for (i = 0; (len < 0 || i < len) && key[i]; i++)
h = qhash(key[i], h);
return h;
}
} kstack[20];
int ktos = 0;
-void time_start_key(char *key)
+void time_start_key(char *key safe)
{
struct timespec start;
kstack[ktos-1].name = key;
}
-static struct khash *hash_find(struct khash **table, char *key)
+static struct khash *hash_find(struct khash **table, char *key safe)
{
struct khash *h, **hp;
int hash;
return h;
}
-void time_stop_key(char *key)
+void time_stop_key(char *key safe)
{
struct timespec stop;
struct khash *h;
struct khash *count_tab[1024];
-void stat_count(char *name)
+void stat_count(char *name safe)
{
struct khash *h;
fprintf(dump_file, " nhash:%d:%d:%d", cnt, buckets, max);
}
-static void hash_free(struct khash **tab)
+static void hash_free(struct khash **tab safe)
{
int i;
* both start and end will point to a NULL chunk.
* When undoing a split, both will be at the point of the split.
*/
-static void text_undo(struct text *t safe, struct text_edit *e,
+static void text_undo(struct text *t safe, struct text_edit *e safe,
struct doc_ref *start safe, struct doc_ref *end safe)
{
if (e->len == 0)
}
}
-static void text_redo(struct text *t safe, struct text_edit *e,
+static void text_redo(struct text *t safe, struct text_edit *e safe,
struct doc_ref *start safe, struct doc_ref *end safe)
{
int is_split = 0;
return 1;
}
-static void text_cleanout(struct text *t)
+static void text_cleanout(struct text *t safe)
{
struct text_alloc *ta;
struct mark *m;
ta = tmp->prev;
free(tmp);
}
- t->alloc = NULL;
+ t->alloc = safe_cast NULL;
while (t->undo) {
struct text_edit *te = t->undo;
t->undo = te->next;
if (!ti->leaf) {
/* probably coming from a pop-up. Just use first tile */
ti2 = tile_first(ti);
+ if (!ti2)
+ return Einval;
if (ci->str2 && ti2->name && strcmp(ci->str2, ti2->name) == 0)
return Einval;
return comm_call(ci->comm2, "callback:pane", ti2->p);
};
void time_start(enum timetype);
void time_stop(enum timetype);
-void time_start_key(char *key);
-void time_stop_key(char *key);
+void time_start_key(char *key safe);
+void time_stop_key(char *key safe);
-void stat_count(char *name);
+void stat_count(char *name safe);
void stat_free(void);
char *match = c;
if (!cd->prefix_only)
match = strstr(match, cd->prefix);
+ if (!match)
+ break;
l = strlen(match);
- if (match[l-1] == '\n')
+ if (l && match[l-1] == '\n')
l -= 1;
if (common == NULL)
common = strndup(match, l);