VALUE rGrok_compile(VALUE self, VALUE pattern) {
  grok_t *grok;
  char *c_pattern;
  long len;
  int ret;
  Data_Get_Struct(self, grok_t, grok);
  c_pattern = rb_str2cstr(pattern, &len);
  ret = grok_compilen(grok, c_pattern, (int)len);
  if (ret) {
    rb_raise(rb_eArgError, "Compile failed: %s", grok->errstr);
  }

  return Qnil;
}
Exemplo n.º 2
0
int grok_compile(grok_t *grok, const char *pattern) {
  return grok_compilen(grok, pattern, strlen(pattern));
}