File: orccode.c

package info (click to toggle)
orc 1%3A0.4.26-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 5,784 kB
  • ctags: 5,605
  • sloc: ansic: 77,058; sh: 4,233; xml: 4,080; makefile: 312
file content (41 lines) | stat: -rw-r--r-- 565 bytes parent folder | download | duplicates (5)
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

#include "config.h"

#include <stdio.h>
#include <string.h>
#include <stdlib.h>

#include <orc/orcprogram.h>
#include <orc/orcdebug.h>


OrcCode *
orc_code_new (void)
{
  OrcCode *code;
  code = malloc(sizeof(OrcCode));
  memset (code, 0, sizeof(OrcCode));
  return code;
}

void
orc_code_free (OrcCode *code)
{
  if (code->insns) {
    free (code->insns);
    code->insns = NULL;
  }
  if (code->vars) {
    free (code->vars);
    code->vars = NULL;
  }
  if (code->chunk) {
    orc_code_chunk_free (code->chunk);
    code->chunk = NULL;
  }

  free (code);
}