ManUtils: Move, use ExtUtils::MakeMaker and get rid of AnyEvent
I mean, I like AnyEvent, but this can be done with core modules as well (albeit somewhat more verbose and error-prone...)
This commit is contained in:
parent
2f33e7f4b5
commit
682321d1be
9 changed files with 92 additions and 106 deletions
28
ManUtils/ManUtils.xs
Normal file
28
ManUtils/ManUtils.xs
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
#include "EXTERN.h"
|
||||
#include "perl.h"
|
||||
#include "XSUB.h"
|
||||
|
||||
struct StringWrap {
|
||||
char *buf;
|
||||
unsigned long long len, cap;
|
||||
};
|
||||
|
||||
struct StringWrap grotty2html_wrap(const char *, unsigned long long);
|
||||
void grotty2html_free(struct StringWrap);
|
||||
|
||||
|
||||
MODULE = ManUtils PACKAGE = ManUtils
|
||||
|
||||
SV *
|
||||
html(str)
|
||||
SV *str
|
||||
CODE:
|
||||
STRLEN len;
|
||||
char *inbuf = SvPV(str, len);
|
||||
struct StringWrap buf = grotty2html_wrap(inbuf, len);
|
||||
SV *dest = buf.len ? newSVpv(buf.buf, buf.len) : newSVpv("", 0);
|
||||
grotty2html_free(buf);
|
||||
SvUTF8_on(dest);
|
||||
RETVAL = dest;
|
||||
OUTPUT:
|
||||
RETVAL
|
||||
Loading…
Add table
Add a link
Reference in a new issue