Open Broadcaster Software
Free, open source software for live streaming and recording
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
decl.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2014 Hugh Bailey <obs.jim@gmail.com>
3  *
4  * Permission to use, copy, modify, and distribute this software for any
5  * purpose with or without fee is hereby granted, provided that the above
6  * copyright notice and this permission notice appear in all copies.
7  *
8  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15  */
16 
17 #pragma once
18 
19 #include "calldata.h"
20 #include "../util/darray.h"
21 
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25 
26 struct decl_param {
27  char *name;
30 };
31 
32 static inline void decl_param_free(struct decl_param *param)
33 {
34  if (param->name)
35  bfree(param->name);
36  memset(param, 0, sizeof(struct decl_param));
37 }
38 
39 struct decl_info {
40  char *name;
41  const char *decl_string;
42  DARRAY(struct decl_param) params;
43 };
44 
45 static inline void decl_info_free(struct decl_info *decl)
46 {
47  if (decl) {
48  for (size_t i = 0; i < decl->params.num; i++)
49  decl_param_free(decl->params.array+i);
50  da_free(decl->params);
51 
52  bfree(decl->name);
53  memset(decl, 0, sizeof(struct decl_info));
54  }
55 }
56 
57 EXPORT bool parse_decl_string(struct decl_info *decl, const char *decl_string);
58 
59 #ifdef __cplusplus
60 }
61 #endif
const char * decl_string
Definition: decl.h:41
unsigned uint32_t
Definition: vc_stdint.h:31
enum call_param_type type
Definition: decl.h:28
#define EXPORT
Definition: c99defs.h:49
uint32_t flags
Definition: decl.h:29
Definition: decl.h:39
EXPORT bool parse_decl_string(struct decl_info *decl, const char *decl_string)
call_param_type
Definition: calldata.h:34
Definition: decl.h:26
char * name
Definition: decl.h:40
#define da_free(v)
Definition: darray.h:456
char * name
Definition: decl.h:27
DARRAY(struct decl_param) params
EXPORT void bfree(void *ptr)