File: memfile.h

package info (click to toggle)
growl-for-linux 0.8.5-10
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,464 kB
  • sloc: sh: 4,121; ansic: 3,748; makefile: 74
file content (61 lines) | stat: -rw-r--r-- 871 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#ifndef plugins_memfile_h_
#define plugins_memfile_h_

#include <stddef.h>

#include "gol.h"

#ifdef __cplusplus
extern "C" {
#endif

typedef struct {
  char*  data;  // response data from server
  size_t size;  // response size of data
} MEMFILE;

GOL_INLINE const char*
memfcdata(const MEMFILE* mf) {
  return mf ? mf->data : NULL;
}

GOL_INLINE char*
memfdata(const MEMFILE* mf) {
  return mf ? mf->data : NULL;
}

GOL_INLINE size_t
memfsize(const MEMFILE* mf) {
  return mf ? mf->size : 0;
}

char*
memfresize(MEMFILE*, size_t);

GOL_INLINE MEMFILE*
memfrelease(MEMFILE** pmf) {
  if (!pmf) return NULL;

  MEMFILE* const tmp = *pmf;
  *pmf = NULL;
  return tmp;
}

MEMFILE*
memfopen();

void
memfclose(MEMFILE*);

size_t
memfwrite(const char*, size_t, size_t, void*);

char*
memfstrdup(const MEMFILE*);

#ifdef __cplusplus
}
#endif

#endif /* plugins_memfile_h_ */