git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: remove duplicate code and not needed break statement

From
Jonathan Nieder <jrnieder@gmail.com>
Date
Jul 19, 2010, 16:06 UTC
Message-ID
<20100719160632.GA17526@burratino>
In-Reply-To
<AANLkTimHHJnvgFh3Kd7jMqTJJFensZjkD7YCU1gdt-FT@mail.gmail.com>
Hi Erik,
Erik Faye-Lund wrote:
> On Sun, Jul 18, 2010 at 7:49 PM, Ralf Thielow
Show 7 quoted lines
>>                case 'D': /* we used to emit D but that was misguided. */
>> -                       goto out_stale;
>> -                       break;
>>                case 'T': /* we used to emit T but nobody uses it. */
>
> We have a tendency of adding a comment pointing out fall through
> between case-statements. Perhaps you should add one?

I think in this case that would not be appropriate. It is the difference between:

	case 1:
	case 2:
	case 3:
		puts("one to three");
		break;
and
	case 1:
		puts("one");
		/* fall through */
	case 2:
	case 3:
		puts("one to three");
		break;

I admit, I am surprised to see multiple suggestions for improvements to details of the patch. I guess I should say, except for the log message, it is

  Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>

i.e., I don’t see any low-hanging fruit for improving it without actually taking a deeper look at the surrounding code. Ralf, can we have your sign-off? That way maybe it could be applied and people could suggest patches on top.

Still, thanks for looking it over.
Jonathan
Previous: Erik Faye-LundNext: Ralf Thielow
Message 7 of 9 in “remove duplicate code and not needed break statement”
  1. Ralf ThielowJul 18, 2010
  2. Valeo de VriesJul 18, 2010
  3. Ralf ThielowJul 18, 2010
  4. Jonathan NiederJul 18, 2010
  5. Ralf ThielowJul 18, 2010
  6. Erik Faye-LundJul 19, 2010
  7. Jonathan NiederJul 19, 2010
  8. Ralf ThielowJul 19, 2010
  9. Ralf ThielowJul 18, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.