svn: /pecl/hidef/trunk/ hidef.c
| From: | Gopal Vijayaraghavan | Date: | Tue, 13 Dec 2011 07:26:44 +0000 |
| Subject: | svn: /pecl/hidef/trunk/ hidef.c | ||
| Groups: | php.pecl.cvs | ||
| Request: | Send a blank email to pecl-cvs+get-17380@lists.php.net to get a copy of this message | ||
gopalv Tue, 13 Dec 2011 07:26:44 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=320932
Log:
allow people to define simple .ini files, which default to string values
Changed paths:
U pecl/hidef/trunk/hidef.c
Modified: pecl/hidef/trunk/hidef.c
===================================================================
--- pecl/hidef/trunk/hidef.c 2011-12-13 07:19:48 UTC (rev 320931)
+++ pecl/hidef/trunk/hidef.c 2011-12-13 07:26:44 UTC (rev 320932)
@@ -361,20 +361,38 @@
}
else
{
- /* TODO: error */
- return;
+ /* syntax error, but we'll assume IS_STRING if there's no space in the name */
+ ctxt->type = IS_NULL;
}
-
- p = strrchr(key, ' ');
- if((p == NULL) || strlen(p) == 1)
+ if(ctxt->type == IS_NULL)
{
- /* TODO: error handling */
- return;
+ if(strrchr(key, ' ') == NULL)
+ {
+ /* honest mistake, let it through as a string */
+ p = key;
+ ctxt->type = IS_STRING;
+ }
+ else
+ {
+ zend_error(E_WARNING, "hidef cannot parse .ini at %s", key);
+ return;
+ }
}
+ else
+ {
+ p = strrchr(key, ' ');
+ if((p == NULL) || strlen(p) == 1)
+ {
+ /* TODO: error handling */
+ return;
+ }
- hidef_define_constant(p+1, arg2, ctxt TSRMLS_CC);
+ p = p + 1; /* skip the space */
+ }
+ hidef_define_constant(p, arg2, ctxt TSRMLS_CC);
+
}
break;