Prevent some more memsets

This commit is contained in:
twinaphex 2016-10-21 19:32:44 +02:00
parent 0ef96ddbbc
commit cb772047ff
3 changed files with 10 additions and 16 deletions

View File

@ -220,7 +220,9 @@ void image_texture_free(struct texture_image *img)
if (img->pixels)
free(img->pixels);
memset(img, 0, sizeof(*img));
img->width = 0;
img->height = 0;
img->pixels = NULL;
}
static enum video_image_format image_texture_get_type(const char *path)

View File

@ -723,17 +723,10 @@ void menu_display_snow(int width, int height)
float alpha;
bool alive;
};
static struct display_particle particles[PARTICLES_COUNT];
static bool initialized = false;
static struct display_particle particles[PARTICLES_COUNT] = {0};
static int timeout = 0;
unsigned i, max_gen = 2;
if (!initialized)
{
memset(particles, 0, sizeof(particles));
initialized = true;
}
for (i = 0; i < PARTICLES_COUNT; ++i)
{
struct display_particle *p = (struct display_particle*)&particles[i];

View File

@ -152,29 +152,28 @@ static void playlist_free_entry(struct playlist_entry *entry)
if (entry->path)
free(entry->path);
entry->path = NULL;
if (entry->label)
free(entry->label);
entry->label = NULL;
if (entry->core_path)
free(entry->core_path);
entry->core_path = NULL;
if (entry->core_name)
free(entry->core_name);
entry->core_name = NULL;
if (entry->db_name)
free(entry->db_name);
entry->core_name = NULL;
if (entry->crc32)
free(entry->crc32);
entry->crc32 = NULL;
memset(entry, 0, sizeof(*entry));
entry->path = NULL;
entry->label = NULL;
entry->core_path = NULL;
entry->core_name = NULL;
entry->db_name = NULL;
entry->crc32 = NULL;
}
void playlist_update(playlist_t *playlist, size_t idx,