Use bzalloc instead of bmalloc then memset
Reduces needless code repetition and still allows for proper memory alignment. Cleans up the code a bit.
This commit is contained in:
@@ -8,12 +8,10 @@ const char *random_getname(const char *locale)
|
||||
|
||||
struct random_tex *random_create(const char *settings, obs_source_t source)
|
||||
{
|
||||
struct random_tex *rt = bmalloc(sizeof(struct random_tex));
|
||||
struct random_tex *rt = bzalloc(sizeof(struct random_tex));
|
||||
uint32_t *pixels = bmalloc(20*20*4);
|
||||
size_t x, y;
|
||||
|
||||
memset(rt, 0, sizeof(struct random_tex));
|
||||
|
||||
for (y = 0; y < 20; y++) {
|
||||
for (x = 0; x < 20; x++) {
|
||||
uint32_t pixel = 0xFF000000;
|
||||
|
Reference in New Issue
Block a user