예제 #1
0
파일: lex.c 프로젝트: dpt/PrivateEye
lex *lex_create(const char *input)
{
  lex *c;

  c = calloc(1, sizeof(*c));
  if (c == NULL)
    return NULL;

  c->peek = ' ';

  c->sym = sym_create();
  if (c->sym == NULL)
    goto oom;

  c->lexbuf = malloc(256);
  if (c->lexbuf == NULL)
    goto oom;

  c->lexbufsz = 256;

  c->input = input;

  return c;

oom:

  sym_destroy(c->sym);
  free(c->lexbuf);
  free(c);

  return NULL;
}
예제 #2
0
파일: lex.c 프로젝트: dpt/PrivateEye
void lex_destroy(lex *doomed)
{
  if (doomed == NULL)
    return;

  sym_destroy(doomed->sym);
  free(doomed->lexbuf);
  free(doomed);
}
예제 #3
0
void zebra_image_scanner_destroy (zebra_image_scanner_t *iscn)
{
    if(iscn->scn)
        zebra_scanner_destroy(iscn->scn);
    iscn->scn = NULL;
    if(iscn->dcode)
        zebra_decoder_destroy(iscn->dcode);
    iscn->dcode = NULL;
    while(iscn->syms) {
        zebra_symbol_t *next = iscn->syms->next;
        sym_destroy(iscn->syms);
        iscn->syms = next;
    }
    free(iscn);
}