Project

General

Profile

Backport #1935 ยป onigtest.c

nobu (Nobuyoshi Nakada), 08/13/2009 03:33 PM

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

#include "ruby.h"
#include "ruby/oniguruma.h"
#include "ruby/encoding.h"

void
onigtest(void)
{
rb_encoding *enc = rb_enc_find("UTF-16LE");

char * p = malloc (16);
int l;

p[0] = '\0';
p[1] = 'a';
p[2] = '\0';
p[3] = '\0';

/* Endless loop on next line: */
l = onigenc_strlen_null(enc, (UChar*)p);

printf ("%d\n", l);

free (p);
}


int main(int argc, char* argv[])
{
ruby_sysinit(&argc, &argv);
{
RUBY_INIT_STACK;
ruby_init();
ruby_init_loadpath();
onigtest();
return ruby_cleanup(0);
}
}

    (1-1/1)