Re: [PATCH v2 05/25] sequencer: allow the sequencer to take custody of malloc()ed data

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Junio,

On Thu, 6 Oct 2016, Junio C Hamano wrote:

> Johannes Schindelin <Johannes.Schindelin@xxxxxx> writes:
> 
> > If you prefer to accept such sloppy work, I will change it of course,
> > feeling dirty that it has my name on it.
> 
> I do want neither leaks nor sloppyness, and I thought that was
> understood by everybody, hence I thought the last round made it
> clear that _entrust() must not exist.

Well, you leave me with but one choice. With shame in my face I will send
out the next re-roll with this construct:

@@ -796,24 +1002,52 @@ static int populate_opts_cb(const char *key, const char *value, void *data)
                opts->allow_ff = git_config_bool_or_int(key, value, &error_flag);
        else if (!strcmp(key, "options.mainline"))
                opts->mainline = git_config_int(key, value);
-       else if (!strcmp(key, "options.strategy"))
-               git_config_string(&opts->strategy, key, value);
-       else if (!strcmp(key, "options.gpg-sign"))
-               git_config_string(&opts->gpg_sign, key, value);
+       else if (!strcmp(key, "options.strategy")) {
+               if (!value)
+                       config_error_nonbool(key);
+               else {
+                       free(opts->strategy);
+                       opts->strategy = xstrdup(value);
+               }
+       }
+       else if (!strcmp(key, "options.gpg-sign")) {
+               if (!value)
+                       config_error_nonbool(key);
+               else {
+                       free(opts->gpg_sign);
+                       opts->gpg_sign = xstrdup(value);
+               }
+       }
...
@@ -37,18 +26,32 @@ struct replay_opts {

        int mainline;

-       const char *gpg_sign;
+       char *gpg_sign;

        /* Merge strategy */
-       const char *strategy;
-       const char **xopts;
+       char *strategy;
+       char **xopts;

(this is not the complete diff, of course, but you get the idea.)

Ciao,
Dscho



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]