Sfoglia il codice sorgente

Remove unnecessary context initialization code

There was no need to call the context free function in the
initialization function, and it's safer to just initialize the memory to
0 before using (which also negates the need for da_init)
jp9000 11 anni fa
parent
commit
d4cf9db638
1 ha cambiato i file con 1 aggiunte e 4 eliminazioni
  1. 1 4
      libobs/obs.c

+ 1 - 4
libobs/obs.c

@@ -1188,10 +1188,9 @@ static inline bool obs_context_data_init_wrap(
 		const char              *name)
 {
 	assert(context);
+	memset(context, 0, sizeof(*context));
 
 	pthread_mutex_init_value(&context->rename_cache_mutex);
-	obs_context_data_free(context);
-
 	if (pthread_mutex_init(&context->rename_cache_mutex, NULL) < 0)
 		return false;
 
@@ -1205,8 +1204,6 @@ static inline bool obs_context_data_init_wrap(
 
 	context->name     = dup_name(name);
 	context->settings = obs_data_newref(settings);
-
-	da_init(context->rename_cache);
 	return true;
 }