mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-03-24 06:50:08 +03:00
examples: Don't use sprintf
Avoids warnings on macOS.
This commit is contained in:
parent
1734d27dca
commit
b8e03e13ed
@ -80,10 +80,10 @@ main(int argc, char **argv)
|
||||
* A simple loop that "automates" nodes creation
|
||||
*/
|
||||
for (i = 5; i < 7; i++) {
|
||||
sprintf(buff, "node%d", i);
|
||||
snprintf(buff, sizeof(buff), "node%d", i);
|
||||
node = xmlNewChild(root_node, NULL, BAD_CAST buff, NULL);
|
||||
for (j = 1; j < 4; j++) {
|
||||
sprintf(buff, "node%d%d", i, j);
|
||||
snprintf(buff, sizeof(buff), "node%d%d", i, j);
|
||||
node1 = xmlNewChild(node, NULL, BAD_CAST buff, NULL);
|
||||
xmlNewProp(node1, BAD_CAST "odd", BAD_CAST((j % 2) ? "no" : "yes"));
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user