Details

[Home]

Issue of the Implementation # D0026

Brief

The "g_key_file_set_comment" interface prepends '#' character to the comment

Detailed Description

Invocation of the interface g_key_file_set_comment with parameters "group_name = some_group, key" = NULL" sets the comment value with perepended character '#'.

Problem location(s) in the standard

Linux Standard Base Desktop Specification 3.1, Chapter 12. Libraries, 12.2 Interfaces for libglib-2.0; http://www.gtk.org/api/2.6/glib/glib-Key-value-file-parser.html#g-key-file-set-comment

Example

#include <stdio.h>
#include <string.h>
#include <glib.h>

#define GROUP   "Another Group"
#define KEY     NULL

char *text="[Another Group]";

int main ()
{
    GKeyFile *gkf=NULL;
    gchar *ret_cmnt=NULL;

    gkf=g_key_file_new();
    g_key_file_load_from_data(gkf, text, strlen(text), 
        G_KEY_FILE_KEEP_COMMENTS, NULL);
    g_key_file_set_comment(gkf, GROUP, KEY, "new_comment", NULL);

    ret_cmnt=g_key_file_get_comment(gkf, GROUP, KEY, NULL);
    printf ("comment = \"%s\" end of comment\n", ret_cmnt);
    return 0;
}

Component

gtk-glib 2.6.2 or later

Accepted

Gnome Bugzilla 479730

[Home]