- struct GNUNNET_CONFIGURATION_Diff_Handle *cfgDiff =
- (struct GNUNNET_CONFIGURATION_Diff_Handle *) cls;
-
- secNew = findSection (cfgDiff->cfgNew, section);
- entNew = findEntry (cfgDiff->cfgNew, section, option);
- if (secNew && strcmp (entNew->val, value) != 0)
- {
- /* Value in the new configuration has been changed */
- /* Add the changed value to the diff configuration object */
- struct ConfigEntry *diffEntry = NULL;
- struct ConfigSection *diffSection = NULL;
-
- diffSection = cfgDiff->cfgDiff->sections;
- if (diffSection == NULL)
- {
- /* First section */
- diffSection = GNUNET_malloc (sizeof (struct ConfigSection));
- memcpy (diffSection, secNew, sizeof (struct ConfigSection));
- cfgDiff->cfgDiff->sections = diffSection;
- diffSection->entries = NULL;
- diffSection->next = NULL;
- }
- else
- {
- while ((strcmp (diffSection->name, secNew->name) != 0)
- && (diffSection->next != NULL))
- {
- diffSection = diffSection->next;
- }
- if (strcmp (diffSection->name, secNew->name) != 0)
- {
- /* Section not found in diffs configuration */
- diffSection->next =
- GNUNET_malloc (sizeof (struct ConfigSection));
- memcpy (diffSection->next, secNew,
- sizeof (struct ConfigSection));
- diffSection->next->entries = NULL;
- diffSection->next->next = NULL;
- }
- else
- {
- diffEntry = diffSection->entries;
- }
- }
-
- if (diffEntry == NULL)
- {
- /* First Entry */
- diffEntry = GNUNET_malloc (sizeof (struct ConfigEntry));
- memcpy (diffEntry, entNew, sizeof (struct ConfigEntry));
- if (diffSection->next == NULL)
- /* The first Entry of the first Section */
- diffSection->entries = diffEntry;
- else
- /* The first entry of the non-first Section */
- diffSection->next->entries = diffEntry;
- diffEntry->next = NULL;
- }
- else
- {
- while (diffEntry->next != NULL)
- {
- diffEntry = diffEntry->next;
- }
- diffEntry->next = GNUNET_malloc (sizeof (struct ConfigEntry));
- memcpy (diffEntry->next, entNew, sizeof (struct ConfigEntry));
- diffEntry->next->next = NULL;
- }
- }