Subject: | ISO C90 forbids mixed declarations and code |
When building File-ExtAttr-0.05, I get a number of warnings about "ISO
C90 forbids mixed declarations and code". This is because variables
need to be declared in PREINIT: blocks instead of CODE: blocks. Recent
versions of GCC let you get away with mixing code and declarations, but
other compilers may not.
I've attached a patch to clean that up.
Other than that, it's been working well and is just what I was looking
for. Thanks.
Subject: | preinit.patch |
--- ExtAttr.xs$ 2006-03-06 14:53:47.000000000 -0600
+++ ExtAttr.xs 2006-08-27 14:51:58.404940974 -0500
@@ -26,11 +26,12 @@
const char *attrname
SV * attrvalueSV
int flags
- CODE:
+ PREINIT:
STRLEN slen;
char * attrvalue;
int rc;
+ CODE:
attrvalue = SvPV(attrvalueSV, slen);
rc = portable_setxattr(path, attrname, attrvalue, slen, flags);
if (rc == -1)
@@ -49,11 +50,12 @@
const char *attrname
SV * attrvalueSV
int flags
- CODE:
+ PREINIT:
STRLEN slen;
char * attrvalue;
int rc;
+ CODE:
attrvalue = SvPV(attrvalueSV, slen);
rc = portable_fsetxattr(fd, attrname, attrvalue, slen, flags);
if (rc == -1)
@@ -71,11 +73,12 @@
const char *path
const char *attrname
int flags
- CODE:
+ PREINIT:
char * attrvalue;
int attrlen;
ssize_t buflen;
+ CODE:
buflen = portable_lenxattr(path, attrname);
if (buflen <= 0)
buflen = SvIV(get_sv(MAX_INITIAL_VALUELEN_VARNAME, FALSE));
@@ -110,11 +113,12 @@
int fd
const char *attrname
int flags
- CODE:
+ PREINIT:
char * attrvalue;
int attrlen;
ssize_t buflen;
+ CODE:
buflen = portable_flenxattr(fd, attrname);
if (buflen <= 0)
buflen = SvIV(get_sv(MAX_INITIAL_VALUELEN_VARNAME, FALSE));
@@ -172,7 +176,7 @@
const char *path
int fd
int flags
- INIT:
+ PREINIT:
ssize_t size, ret;
char *namebuf = NULL;
char *nameptr;