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:
jp9000
2014-02-09 12:34:07 -07:00
parent 6ffcd5e74e
commit b067440f73
32 changed files with 58 additions and 113 deletions

View File

@@ -23,11 +23,9 @@ static pthread_mutex_t c_mutex;
struct desktop_tex *osx_desktop_test_create(const char *settings,
obs_source_t source)
{
struct desktop_tex *rt = bmalloc(sizeof(struct desktop_tex));
struct desktop_tex *rt = bzalloc(sizeof(struct desktop_tex));
char *effect_file;
memset(rt, 0, sizeof(struct desktop_tex));
gs_entercontext(obs_graphics());
struct gs_sampler_info info = {

View File

@@ -7,9 +7,8 @@ const char *test_getname(const char *locale)
struct test_filter *test_create(const char *settings, obs_source_t source)
{
struct test_filter *tf = bmalloc(sizeof(struct test_filter));
struct test_filter *tf = bzalloc(sizeof(struct test_filter));
char *effect_file;
memset(tf, 0, sizeof(struct test_filter));
gs_entercontext(obs_graphics());

View File

@@ -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;

View File

@@ -52,8 +52,7 @@ const char *sinewave_getname(const char *locale)
struct sinewave_data *sinewave_create(const char *settings, obs_source_t source)
{
struct sinewave_data *swd = bmalloc(sizeof(struct sinewave_data));
memset(swd, 0, sizeof(struct sinewave_data));
struct sinewave_data *swd = bzalloc(sizeof(struct sinewave_data));
swd->source = source;
if (event_init(&swd->event, EVENT_TYPE_MANUAL) != 0)