瀏覽代碼

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 年之前
父節點
當前提交
d4cf9db638
共有 1 個文件被更改,包括 1 次插入4 次删除
  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;
 }