summaryrefslogtreecommitdiff
path: root/plugins/yaml/line.c
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2023-02-04 16:36:10 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2023-02-04 16:36:10 (GMT)
commite85f35454bf94b7414dd9d2f5e6609601951293c (patch)
treef8cf3afe5b2ed34949878552b663d4b037e16238 /plugins/yaml/line.c
parentdb3b204dd7a71b2f74a4e69b2159a96e3ab66614 (diff)
Provide constructor to load Yaml contents without external files.
Diffstat (limited to 'plugins/yaml/line.c')
-rw-r--r--plugins/yaml/line.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/plugins/yaml/line.c b/plugins/yaml/line.c
index 26a1012..3466bb8 100644
--- a/plugins/yaml/line.c
+++ b/plugins/yaml/line.c
@@ -177,6 +177,7 @@ static void g_yaml_line_finalize(GYamlLine *line)
/******************************************************************************
* *
* Paramètres : raw = contenu brut d'une ligne au format Yaml. *
+* rlen = taille de ce contenu brut. *
* number = indice associé à la ligne. *
* *
* Description : Met en place un gestionnaire pour ligne au format Yaml. *
@@ -187,7 +188,7 @@ static void g_yaml_line_finalize(GYamlLine *line)
* *
******************************************************************************/
-GYamlLine *g_yaml_line_new(const char *raw, size_t number)
+GYamlLine *g_yaml_line_new(const char *raw, size_t rlen, size_t number)
{
GYamlLine *result; /* Structure à retourner */
char *iter; /* Boucle de parcours */
@@ -196,7 +197,7 @@ GYamlLine *g_yaml_line_new(const char *raw, size_t number)
result = g_object_new(G_TYPE_YAML_LINE, NULL);
- result->raw = strdup(raw);
+ result->raw = strndup(raw, rlen);
result->number = number;
/* Indentation */