>On Wed, Jun 10, 2020 at 09:20:39AM +0800, Shi Lei wrote: >> Signed-off-by: Shi Lei <shi_lei@xxxxxxxxxxxxxx> >> --- >> src/conf/network_conf.c | 18 ++---------------- >> src/conf/network_conf.h | 4 ++-- >> 2 files changed, 4 insertions(+), 18 deletions(-) >> >> diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c >> index bfdc10b..e8e7922 100644 >> --- a/src/conf/network_conf.c >> +++ b/src/conf/network_conf.c >> @@ -2275,22 +2275,8 @@ virNetworkDNSDefFormat(virBufferPtr buf, >> >> for (i = 0; i < def->nsrvs; i++) { >> if (def->srvs[i].service && def->srvs[i].protocol) { >> - virBufferEscapeString(buf, "<srv service='%s' ", >> - def->srvs[i].service); >> - virBufferEscapeString(buf, "protocol='%s'", def->srvs[i].protocol); >> - >> - if (def->srvs[i].domain) >> - virBufferEscapeString(buf, " domain='%s'", def->srvs[i].domain); >> - if (def->srvs[i].target) >> - virBufferEscapeString(buf, " target='%s'", def->srvs[i].target); >> - if (def->srvs[i].port) >> - virBufferAsprintf(buf, " port='%d'", def->srvs[i].port); >> - if (def->srvs[i].priority) >> - virBufferAsprintf(buf, " priority='%d'", def->srvs[i].priority); >> - if (def->srvs[i].weight) >> - virBufferAsprintf(buf, " weight='%d'", def->srvs[i].weight); >> - >> - virBufferAddLit(buf, "/>\n"); >> + if (virNetworkDNSSrvDefFormatBuf(buf, "srv", &def->srvs[i], NULL) < 0) >> + return -1; >> } >> } >> >> diff --git a/src/conf/network_conf.h b/src/conf/network_conf.h >> index 3a4d829..c867f27 100644 >> --- a/src/conf/network_conf.h >> +++ b/src/conf/network_conf.h >> @@ -137,10 +137,10 @@ struct _virNetworkDNSTxtDef { /* genparse:concisehook, genformat */ >> >> typedef struct _virNetworkDNSSrvDef virNetworkDNSSrvDef; >> typedef virNetworkDNSSrvDef *virNetworkDNSSrvDefPtr; >> -struct _virNetworkDNSSrvDef { /* genparse:withhook */ >> - char *domain; /* xmlattr */ >> +struct _virNetworkDNSSrvDef { /* genparse:withhook, genformat */ >> char *service; /* xmlattr */ >> char *protocol; /* xmlattr */ >> + char *domain; /* xmlattr */ >> char *target; /* xmlattr */ >> unsigned int port; /* xmlattr */ >> unsigned int priority; /* xmlattr */ > >Why did the order of fields in the struct change ? Was this to make sure >that auto-generated code formats attributes in the same order as the old >code ? If so, that is ok. Yes, I just want to keep the same order with the old format function. Regards, Shi Lei > >Regards, >Daniel >-- >|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| >|: https://libvirt.org -o- https://fstop138.berrange.com :| >|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :| >