Code cleanup
This commit is contained in:
parent
535593184b
commit
4728b92e29
@ -1077,18 +1077,20 @@ static int _current_loop_applications(Desktop * desktop)
|
|||||||
&& de->d_name[2] == '\0'))
|
&& de->d_name[2] == '\0'))
|
||||||
continue;
|
continue;
|
||||||
len = strlen(de->d_name);
|
len = strlen(de->d_name);
|
||||||
if(len < sizeof(ext) || strncmp(&de->d_name[len - sizeof(ext)
|
if(len < sizeof(ext))
|
||||||
+ 1], ext, sizeof(ext)) != 0)
|
|
||||||
continue;
|
continue;
|
||||||
if((p = realloc(path, desktop->path_cnt + len + 1)) == NULL)
|
if(strncmp(&de->d_name[len - sizeof(ext) + 1], ext,
|
||||||
|
sizeof(ext)) != 0)
|
||||||
|
continue;
|
||||||
|
len = desktop->path_cnt + len + 1;
|
||||||
|
if((p = realloc(path, len)) == NULL)
|
||||||
{
|
{
|
||||||
error_set_print("desktop", 1, "%s: %s", "realloc",
|
error_set_print("desktop", 1, "%s: %s", "realloc",
|
||||||
strerror(errno));
|
strerror(errno));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
path = p;
|
path = p;
|
||||||
snprintf(path, desktop->path_cnt + len + 1, "%s/%s",
|
snprintf(path, len, "%s/%s", desktop->path, de->d_name);
|
||||||
desktop->path, de->d_name);
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
fprintf(stderr, "DEBUG: %s() \"%s\"\n", __func__, path);
|
fprintf(stderr, "DEBUG: %s() \"%s\"\n", __func__, path);
|
||||||
#endif
|
#endif
|
||||||
@ -1130,18 +1132,20 @@ static int _current_loop_categories(Desktop * desktop)
|
|||||||
&& de->d_name[2] == '\0'))
|
&& de->d_name[2] == '\0'))
|
||||||
continue;
|
continue;
|
||||||
len = strlen(de->d_name);
|
len = strlen(de->d_name);
|
||||||
if(len < sizeof(ext) || strncmp(&de->d_name[len - sizeof(ext)
|
if(len < sizeof(ext))
|
||||||
+ 1], ext, sizeof(ext)) != 0)
|
|
||||||
continue;
|
continue;
|
||||||
if((p = realloc(path, desktop->path_cnt + len + 1)) == NULL)
|
if(strncmp(&de->d_name[len - sizeof(ext) + 1], ext,
|
||||||
|
sizeof(ext)) != 0)
|
||||||
|
continue;
|
||||||
|
len = desktop->path_cnt + len + 1;
|
||||||
|
if((p = realloc(path, len)) == NULL)
|
||||||
{
|
{
|
||||||
error_set_print("desktop", 1, "%s: %s", "realloc",
|
error_set_print("desktop", 1, "%s: %s", "realloc",
|
||||||
strerror(errno));
|
strerror(errno));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
path = p;
|
path = p;
|
||||||
snprintf(path, desktop->path_cnt + len + 1, "%s/%s",
|
snprintf(path, len, "%s/%s", desktop->path, de->d_name);
|
||||||
desktop->path, de->d_name);
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
fprintf(stderr, "DEBUG: %s() \"%s\"\n", __func__, path);
|
fprintf(stderr, "DEBUG: %s() \"%s\"\n", __func__, path);
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user