/+junk/codegen

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/%2Bjunk/codegen

« back to all changes in this revision

Viewing changes to src/configuration.c

  • Committer: Gustav Hartvigsson
  • Date: 2022-10-19 21:06:55 UTC
  • Revision ID: gustav.hartvigsson@gmail.com-20221019210655-9iqu2dhjbpvedoma
Beep Boop, nothin yet.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include "configuration.h"
 
2
#include "utils.h"
 
3
 
 
4
Configuration * configuration_default_instance = NULL;
 
5
 
 
6
Configuration *
 
7
configuration_get_default () {
 
8
  if (configuration_default_instance == NULL) {
 
9
    configuration_default_instance = malloc0 (sizeof (Configuration));
 
10
  }
 
11
  return configuration_default_instance;
 
12
}
 
13
 
 
14
void
 
15
configuration_set_default (Configuration * cfg) {
 
16
  configuration_default_instance = cfg;
 
17
}
 
18
 
 
19
void
 
20
configuration_set_default0 (Configuration * cfg) {
 
21
  auto old = configuration_default_instance;
 
22
  configuration_default_instance = cfg;
 
23
  free (old);
 
24
}
 
25
 
 
26
void
 
27
configuration_free_default () {
 
28
  free (configuration_default_instance);
 
29
}