diff for duplicates of <20170925203901.0009b327@naga> diff --git a/a/1.txt b/N1/1.txt index f8948e2..b0465b1 100644 --- a/a/1.txt +++ b/N1/1.txt @@ -1,45 +1,45 @@ On Fri, 15 Sep 2017 19:28:56 +0200 -Michal Such=C3=A1nek <msuchanek@suse.de> wrote: +Michal Suchánek <msuchanek@suse.de> wrote: > On Fri, 15 Sep 2017 18:14:09 +0100 > Al Viro <viro@ZenIV.linux.org.uk> wrote: ->=20 +> > > On Fri, Sep 15, 2017 at 07:02:46PM +0200, Michal Suchanek wrote: -> > =20 -> > > for (i =3D 0; args[i]; i++) { +> > +> > > for (i = 0; args[i]; i++) { > > > - if (isspace(args[i]) && !in_quote) > > > + if (isspace(args[i]) && !in_quote && !backslash) > > > break; -> > > - if (equals =3D=3D 0) { -> > > - if (args[i] =3D=3D '=3D') -> > > - equals =3D i; +> > > - if (equals == 0) { +> > > - if (args[i] == '=') +> > > - equals = i; > > > + -> > > + if ((equals =3D=3D 0) && (args[i] =3D=3D '=3D')) -> > > + equals =3D i; +> > > + if ((equals == 0) && (args[i] == '=')) +> > > + equals = i; > > > + > > > + if (!backslash) { -> > > + if ((args[i] =3D=3D '"') || (args[i] =3D=3D +> > > + if ((args[i] == '"') || (args[i] == > > > '\\')) { -> > > + if (args[i] =3D=3D '"') -> > > + in_quote =3D !in_quote; -> > > + if (args[i] =3D=3D '\\') -> > > + backslash =3D 1; +> > > + if (args[i] == '"') +> > > + in_quote = !in_quote; +> > > + if (args[i] == '\\') +> > > + backslash = 1; > > > + > > > + memmove(args + 1, args, i); > > > + args++; > > > + i--; > > > + } > > > + } else { -> > > + backslash =3D 0; +> > > + backslash = 0; > > > } -> > > - if (args[i] =3D=3D '"') -> > > - in_quote =3D !in_quote; -> > > } =20 -> >=20 +> > > - if (args[i] == '"') +> > > - in_quote = !in_quote; +> > > } +> > > > ... and that makes for Unidiomatic Work With Strings Award for this > > September. Using memmove() for string rewrite is almost always bad -> > taste; in this case it's also (as usual) broken. =20 ->=20 +> > taste; in this case it's also (as usual) broken. +> > Care to share how it is broken? Guess not. I will assume it is perfectly fine then. It works perfectly diff --git a/a/content_digest b/N1/content_digest index 89b1373..bd1688b 100644 --- a/a/content_digest +++ b/N1/content_digest @@ -27,47 +27,47 @@ "\00:1\0" "b\0" "On Fri, 15 Sep 2017 19:28:56 +0200\n" - "Michal Such=C3=A1nek <msuchanek@suse.de> wrote:\n" + "Michal Such\303\241nek <msuchanek@suse.de> wrote:\n" "\n" "> On Fri, 15 Sep 2017 18:14:09 +0100\n" "> Al Viro <viro@ZenIV.linux.org.uk> wrote:\n" - ">=20\n" + "> \n" "> > On Fri, Sep 15, 2017 at 07:02:46PM +0200, Michal Suchanek wrote:\n" - "> > =20\n" - "> > > \tfor (i =3D 0; args[i]; i++) {\n" + "> > \n" + "> > > \tfor (i = 0; args[i]; i++) {\n" "> > > -\t\tif (isspace(args[i]) && !in_quote)\n" "> > > +\t\tif (isspace(args[i]) && !in_quote && !backslash)\n" "> > > \t\t\tbreak;\n" - "> > > -\t\tif (equals =3D=3D 0) {\n" - "> > > -\t\t\tif (args[i] =3D=3D '=3D')\n" - "> > > -\t\t\t\tequals =3D i;\n" + "> > > -\t\tif (equals == 0) {\n" + "> > > -\t\t\tif (args[i] == '=')\n" + "> > > -\t\t\t\tequals = i;\n" "> > > +\n" - "> > > +\t\tif ((equals =3D=3D 0) && (args[i] =3D=3D '=3D'))\n" - "> > > +\t\t\tequals =3D i;\n" + "> > > +\t\tif ((equals == 0) && (args[i] == '='))\n" + "> > > +\t\t\tequals = i;\n" "> > > +\n" "> > > +\t\tif (!backslash) {\n" - "> > > +\t\t\tif ((args[i] =3D=3D '\"') || (args[i] =3D=3D\n" + "> > > +\t\t\tif ((args[i] == '\"') || (args[i] ==\n" "> > > '\\\\')) {\n" - "> > > +\t\t\t\tif (args[i] =3D=3D '\"')\n" - "> > > +\t\t\t\t\tin_quote =3D !in_quote;\n" - "> > > +\t\t\t\tif (args[i] =3D=3D '\\\\')\n" - "> > > +\t\t\t\t\tbackslash =3D 1;\n" + "> > > +\t\t\t\tif (args[i] == '\"')\n" + "> > > +\t\t\t\t\tin_quote = !in_quote;\n" + "> > > +\t\t\t\tif (args[i] == '\\\\')\n" + "> > > +\t\t\t\t\tbackslash = 1;\n" "> > > +\n" "> > > +\t\t\t\tmemmove(args + 1, args, i);\n" "> > > +\t\t\t\targs++;\n" "> > > +\t\t\t\ti--;\n" "> > > +\t\t\t}\n" "> > > +\t\t} else {\n" - "> > > +\t\t\tbackslash =3D 0;\n" + "> > > +\t\t\tbackslash = 0;\n" "> > > \t\t}\n" - "> > > -\t\tif (args[i] =3D=3D '\"')\n" - "> > > -\t\t\tin_quote =3D !in_quote;\n" - "> > > \t} =20\n" - "> >=20\n" + "> > > -\t\tif (args[i] == '\"')\n" + "> > > -\t\t\tin_quote = !in_quote;\n" + "> > > \t} \n" + "> > \n" "> > ... and that makes for Unidiomatic Work With Strings Award for this\n" "> > September. Using memmove() for string rewrite is almost always bad\n" - "> > taste; in this case it's also (as usual) broken. =20\n" - ">=20\n" + "> > taste; in this case it's also (as usual) broken. \n" + "> \n" "> Care to share how it is broken?\n" "\n" "Guess not. I will assume it is perfectly fine then. It works perfectly\n" @@ -80,4 +80,4 @@ "\n" Michal -807e740568ae9f15cc5a18fe8cf8e5f7e611ccaa5384e4427a5a51c9f4195ae8 +62582be70d2cca958f658c5ca91542682c12f3f204e46456319543cb3a342fba
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.