From: Daniel Carl <danielcarl@gmx.de>
Date: Sun, 17 Aug 2014 13:30:50 +0000 (+0200)
Subject: Fixed wrong value in :set+= for integer vars.
X-Git-Url: https://git.owens.tech/dummy.html/dummy.html/git?a=commitdiff_plain;h=60adcceaa7068c3381362ec3721b5f7d8959c9fe;p=vimb.git

Fixed wrong value in :set+= for integer vars.
---

diff --git a/src/setting.c b/src/setting.c
index d803b8b..9cc1f9c 100644
--- a/src/setting.c
+++ b/src/setting.c
@@ -385,15 +385,16 @@ static gboolean prepare_setting_value(Setting *prop, void *value, SettingType ty
 
     /* perform arithmetic operation for integer values */
     if (prop->type == TYPE_INTEGER) {
-        int newint;
+        int *newint = g_malloc(sizeof(int));
+        res         = true;
         if (type == SETTING_APPEND) {
-            newint = prop->value.i + *((int*)value);
+            *newint = prop->value.i + *((int*)value);
         } else if (type == SETTING_PREPEND) {
-            newint = prop->value.i * *((int*)value);
+            *newint = prop->value.i * *((int*)value);
         } else if (type == SETTING_REMOVE) {
-            newint = prop->value.i - *((int*)value);
+            *newint = prop->value.i - *((int*)value);
         }
-        *newvalue = (void*)&newint;
+        *newvalue = (void*)newint;
         return res;
     }