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

Re: [PATCH] general style: replaces memcmp() with starts_with()

From
Duy Nguyen <pclouds@gmail.com>
Date
Mar 12, 2014, 23:26 UTC
Message-ID
<CACsJy8D-GpuepvoUfTzAVgd=Uo6U90V9=kYnfUD-0SOsYK7e9Q@mail.gmail.com>
In-Reply-To
<532097D0.4070909@web.de>
On Thu, Mar 13, 2014 at 12:22 AM, Jens Lehmann <Jens.Lehmann@web.de> wrote:
> That spot uses memcmp() because ce->name may
> not be 0-terminated.

ce->name is 0-terminated (at least if it's created the normal way, I haven't checked where this "ce" in submodule.c comes from). ce_namelen() is just an optimization because we happen to store name's length if it's shorter than 4096, so there's no need to strlen(ce->name) again.

-- 
Duy
Previous: Jeff King
Message 10 of 10 in “general style: replaces memcmp() with starts_with()”
  1. general style: replaces memcmp() with starts_with()Quint Guvernator, Mar 12, 2014
  2. Duy NguyenMar 12, 2014
  3. Quint GuvernatorMar 12, 2014
  4. Michael HaggertyMar 13, 2014
  5. Quint GuvernatorMar 14, 2014
  6. Jens LehmannMar 12, 2014
  7. Quint GuvernatorMar 12, 2014
  8. Jens LehmannMar 12, 2014
  9. Jeff KingMar 12, 2014
  10. Duy NguyenMar 12, 2014

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.