Thank you for your feedback. I overlooked my coding style violation, because I ran "make syntax-check" and it finished without any error.
I suppose that you mean the curly bracket should be removed from if and else sentence because the body and condition itself occupy a single line. If there is any other coding style violation, could you tell me what it is? Regards, Shotaro 2019年3月12日(火) 19:33 Peter Krempa <[email protected]>: > On Tue, Mar 12, 2019 at 18:56:22 +0900, Shotaro Gotanda wrote: > > This function parse the string "yes" into bool true and > > "no" into false, and return 0. > > If the string is anything other than "yes|no", > > this function return -1. > > > > Signed-off-by: Shotaro Gotanda <[email protected]> > > --- > > src/util/virstring.c | 23 +++++++++++++++++++++++ > > src/util/virstring.h | 3 +++ > > 2 files changed, 26 insertions(+) > > > > diff --git a/src/util/virstring.c b/src/util/virstring.c > > index 33f8191f45..945a8d0c84 100644 > > --- a/src/util/virstring.c > > +++ b/src/util/virstring.c > > @@ -1548,3 +1548,26 @@ virStringParsePort(const char *str, > > > > return 0; > > } > > + > > + > > +/** > > + * virStringParseYesNo: > > + * @str: "yes|no" to parse, and the value must not be NULL. > > + * @port: pointer to parse and convert "yes|no" into > > + * > > + * Parses a string "yes|no" and convert it into true|false. > > + * Returns 0 on success and -1 on error. > > + */ > > +int virStringParseYesNo(const char *str, bool *result) > > +{ > > + > > + if (STREQ(str, "yes")) { > > + *result = true; > > + } else if (STREQ(str, "no")) { > > + *result = false; > > + } else { > > + return -1; > > This does not conform to our coding style. Please make sure to read the > guidelines and run syntax-check before posting. > > > + } > > + > > + return 0; > > +} > > diff --git a/src/util/virstring.h b/src/util/virstring.h > > index 1e36ac459c..9b01e8568a 100644 > > --- a/src/util/virstring.h > > +++ b/src/util/virstring.h > > @@ -316,6 +316,9 @@ int virStringParsePort(const char *str, > > unsigned int *port) > > ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK; > > > > +int virStringParseYesNo(const char *str, > > + bool *result) > > + ATTRIBUTE_RETURN_CHECK; > > /** > > * VIR_AUTOSTRINGLIST: > > * > > -- > > 2.19.1 > > > > -- > > libvir-list mailing list > > [email protected] > > https://www.redhat.com/mailman/listinfo/libvir-list > -----BEGIN PGP SIGNATURE----- > > iQIzBAEBCAAdFiEEUn7DGLvflazX+2GwHGwCByjY1GoFAlyHiwgACgkQHGwCByjY > 1GoDCw//ZpVdt+38W0A3Qdx8j4tKXRo4C3WLQEABRNIVXH+IF9esTYIQ7cmaH6rV > p5bZQQILTC/lonDdxVBESYpOVUcU+VeZzMKLEqHJNTPdIyPvoFQTrpKD5Dm1VDcX > 7TbBuMBvR6mkBqSu8MkreZ/UvyyIf16ATH/JWM0rTujJtZN5EIOYABkHsF+BBZrj > tIC1E6d8nmkhw3U5KPDA94YzhptxKGsK+7wd9if9QDtd6TDoFsiJZcOyDYOBHOi/ > fnbrBkckdbVSvI9IGYZMVdDqBBbjUK73v2dNQWWKffzzEVAXKPG7j0YB3rgVmDqE > 6de3P+sbpgdg9jD5rHxSEaCEM5d6we3I5ajKK5brT3POmVbhrmmidlvWEKT2HTBB > J/qs1tThRnaRUCcnYflhR+jl/7e6rkvA4FBv+1ycq4CCCDGujYfMJqjIIRRqel+j > GveeFQlXf9UBiZbF6E5rCTqQsdPFlKVin0WgOQYXGj2gH7gJ+0e7XqZAoeMEtXqC > X3DknMP31h+hFQIt/TftDZU+1ZloujYOWOvigQ7xxJgPqB2KNk1D37H6vbRoleUp > o6xmtnOVc5PYbbTq1PGh7E62qeb6eOIvfe3OtpRDuN/zoHxJnnTIUVLKOf1H3Cqo > y6c/4hFQ6oH52hIvyzNa2OOf+UM3S7/jmetj64YeC98jy7tmYTU= > =bZTz > -----END PGP SIGNATURE----- >
-- libvir-list mailing list [email protected] https://www.redhat.com/mailman/listinfo/libvir-list
