[svn] gpgme - r1508 - trunk/src

svn author marcus cvs at cvs.gnupg.org
Fri Nov 19 17:06:44 CET 2010


Author: marcus
Date: 2010-11-19 17:06:43 +0100 (Fri, 19 Nov 2010)
New Revision: 1508

Modified:
   trunk/src/ChangeLog
   trunk/src/engine-gpgconf.c
Log:
2010-11-19  Marcus Brinkmann  <mb at g10code.com>

	* engine-gpgconf.c (_gpgme_conf_opt_change): Support
	self-assignment.  Requested by Marc Mutz.


Modified: trunk/src/ChangeLog
===================================================================
--- trunk/src/ChangeLog	2010-11-17 02:11:05 UTC (rev 1507)
+++ trunk/src/ChangeLog	2010-11-19 16:06:43 UTC (rev 1508)
@@ -1,3 +1,8 @@
+2010-11-19  Marcus Brinkmann  <mb at g10code.com>
+
+	* engine-gpgconf.c (_gpgme_conf_opt_change): Support
+	self-assignment.  Requested by Marc Mutz.
+
 2010-11-17  Marcus Brinkmann  <mb at g10code.com>
 
 	* vasprintf.c (int_vasprintf) [HAVE_W32CE_SYSTEM]: Just use a

Modified: trunk/src/engine-gpgconf.c
===================================================================
--- trunk/src/engine-gpgconf.c	2010-11-17 02:11:05 UTC (rev 1507)
+++ trunk/src/engine-gpgconf.c	2010-11-19 16:06:43 UTC (rev 1508)
@@ -618,17 +618,22 @@
 gpgme_error_t
 _gpgme_conf_opt_change (gpgme_conf_opt_t opt, int reset, gpgme_conf_arg_t arg)
 {
-  if (opt->new_value)
-    release_arg (opt->new_value, opt->alt_type);
-
   if (reset)
     {
-      opt->new_value = NULL;
+      if (opt->new_value)
+	release_arg (opt->new_value, opt->alt_type);
+     opt->new_value = NULL;
       opt->change_value = 0;
     }
   else
     {
-      opt->new_value = arg;
+      /* Support self-assignment, for example for adding an item to an
+	 existing list.  */
+      if (opt->new_value && arg != opt->new_value)
+	{
+	  release_arg (opt->new_value, opt->alt_type);
+	  opt->new_value = arg;
+	}
       opt->change_value = 1;
     }
   return 0;





More information about the Gnupg-commits mailing list