提交 c63f08e0 编写于 作者: D Daniel P. Berrange

Allow trailing ',' in lists, and '_' in names

上级 184c0bba
Sun Sep 3 12:50:12 EDT 2006 Daniel Berrange <berrange@redhat.com>
* src/conf.c: Allow '_' in variable names, and don't fail if there
is a trailing ',' at the end of a list.
* tests/confdata/fc4.conf, tests/confdata/fc4.out: Expand test
config to include a '_' in a name, and a trailing ',' in a list.
Sun Sep 3 12:47:42 EDT 2006 Daniel Berrange <berrange@redhat.com> Sun Sep 3 12:47:42 EDT 2006 Daniel Berrange <berrange@redhat.com>
* tests/.cvsignore, tests/confdata/.cvsignore: Ignore autogenerated * tests/.cvsignore, tests/confdata/.cvsignore: Ignore autogenerated
......
...@@ -443,6 +443,9 @@ virConfParseValue(virConfParserCtxtPtr ctxt) ...@@ -443,6 +443,9 @@ virConfParseValue(virConfParserCtxtPtr ctxt)
} }
NEXT; NEXT;
SKIP_BLANKS; SKIP_BLANKS;
if (CUR == ']') {
break;
}
tmp = virConfParseValue(ctxt); tmp = virConfParseValue(ctxt);
if (tmp == NULL) { if (tmp == NULL) {
virConfFreeList(lst); virConfFreeList(lst);
...@@ -508,7 +511,7 @@ virConfParseName(virConfParserCtxtPtr ctxt) ...@@ -508,7 +511,7 @@ virConfParseName(virConfParserCtxtPtr ctxt)
virConfError(NULL, VIR_ERR_CONF_SYNTAX, "expecting a name", ctxt->line); virConfError(NULL, VIR_ERR_CONF_SYNTAX, "expecting a name", ctxt->line);
return(NULL); return(NULL);
} }
while ((ctxt->cur < ctxt->end) && ((IS_CHAR(CUR)) || (IS_DIGIT(CUR)))) while ((ctxt->cur < ctxt->end) && ((IS_CHAR(CUR)) || (IS_DIGIT(CUR)) || (CUR == '_')))
NEXT; NEXT;
ret = strndup(base, ctxt->cur - base); ret = strndup(base, ctxt->cur - base);
if (ret == NULL) { if (ret == NULL) {
......
...@@ -2,9 +2,10 @@ kernel="/boot/vmlinuz-2.6.15-1.2054_FC5xenU" ...@@ -2,9 +2,10 @@ kernel="/boot/vmlinuz-2.6.15-1.2054_FC5xenU"
ramdisk="/boot/initrd-2.6.15-1.2054_FC5xenU.img" ramdisk="/boot/initrd-2.6.15-1.2054_FC5xenU.img"
memory=128 # should be enough memory=128 # should be enough
name="fc4" name="fc4"
vif = [ 'mac=aa:00:00:00:00:11, bridge=xenbr0' ] vif = [ 'mac=aa:00:00:00:00:11, bridge=xenbr0', ]
disk = ['file:/xen/fc4.img,sda1,w'] disk = ['file:/xen/fc4.img,sda1,w']
root = "/dev/sda1" root = "/dev/sda1"
extra = "ro selinux=0 3" extra = "ro selinux=0 3"
on_reboot = 'restart'
# just for testing ... # just for testing ...
tst = [ 1, 2, [ 3, 4 ], 5] tst = [ 1, 2, [ 3, 4 ], 5]
...@@ -6,5 +6,6 @@ vif = [ "mac=aa:00:00:00:00:11, bridge=xenbr0" ] ...@@ -6,5 +6,6 @@ vif = [ "mac=aa:00:00:00:00:11, bridge=xenbr0" ]
disk = [ "file:/xen/fc4.img,sda1,w" ] disk = [ "file:/xen/fc4.img,sda1,w" ]
root = "/dev/sda1" root = "/dev/sda1"
extra = "ro selinux=0 3" extra = "ro selinux=0 3"
on_reboot = "restart"
# just for testing ... # just for testing ...
tst = [ 1, 2, [ 3, 4 ], 5 ] tst = [ 1, 2, [ 3, 4 ], 5 ]
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册