Wireshark  4.3.0
The Wireshark network protocol analyzer
glib-compat.h
Go to the documentation of this file.
1 
12 #ifndef GLIB_COMPAT_H
13 #define GLIB_COMPAT_H
14 
15 #include "ws_symbol_export.h"
16 #include "ws_attributes.h"
17 
18 #include <glib.h>
19 #include <string.h>
20 
21 #ifdef __cplusplus
22 extern "C" {
23 #endif /* __cplusplus */
24 
25 #if !GLIB_CHECK_VERSION(2, 68, 0)
26 static inline void *
27 g_memdup2(gconstpointer mem, size_t byte_size)
28 {
29  void * new_mem;
30 
31  if (mem && byte_size != 0) {
32  new_mem = g_malloc(byte_size);
33  memcpy(new_mem, mem, byte_size);
34  }
35  else
36  new_mem = NULL;
37 
38  return new_mem;
39 }
40 #endif
41 
42 #ifdef __cplusplus
43 }
44 #endif /* __cplusplus */
45 
46 #endif /* GLIB_COMPAT_H */