From: "Joachim Schmitz" <jojo@schmitz-digital.de>
To: git@vger.kernel.org
Subject: Re: [PATCH 08/10] Integrate wildmatch to git
Date: Sat, 6 Oct 2012 11:25:35 +0200 [thread overview]
Message-ID: <k4otes$jll$1@ger.gmane.org> (raw)
In-Reply-To: CACnwZYeob34c6hbMX-CNvJ67Qu5b+v7J8SbfcBOgZv6Qu+aqFg@mail.gmail.com
Thiago Farina wrote:
> On Fri, Oct 5, 2012 at 1:41 AM, Nguyễn Thái Ngọc Duy
> <pclouds@gmail.com> wrote:
>> This makes wildmatch.c part of libgit.a and builds test-wildmatch;
>> the dependency on libpopt in the original has been replaced with the
>> use
>> of our parse-options. Global variables in test-wildmatch are marked
>> static to avoid sparse warnings.
>>
>> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
>> Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
>> Signed-off-by: Junio C Hamano <gitster@pobox.com>
>> ---
>> .gitignore | 1 +
>> Makefile | 3 ++
>> t/t3070-wildmatch.sh | 27 ++++++++++++++++
>> test-wildmatch.c | 88
>> ++++++++++++++++++++++------------------------------ wildmatch.c
>> | 26 +++++----------- 5 files changed, 75 insertions(+), 70
>> deletions(-) create mode 100755 t/t3070-wildmatch.sh
>>
>> diff --git a/test-wildmatch.c b/test-wildmatch.c
>> index 88585c2..bb726c8 100644
>> --- a/test-wildmatch.c
>> +++ b/test-wildmatch.c
>> @@ -19,34 +19,38 @@
>>
>> /*#define COMPARE_WITH_FNMATCH*/
>>
>> -#define WILD_TEST_ITERATIONS
>> -#include "lib/wildmatch.c"
>> +#include "cache.h"
>> +#include "parse-options.h"
>> +#include "wildmatch.h"
>>
>> -#include <popt.h>
>> +#ifndef MAXPATHLEN
>> +#define MAXPATHLEN 1024
>> +#endif
>> +#ifdef NO_STRLCPY
>> +#include "compat/strlcpy.c"
>> +#define strlcpy gitstrlcpy
>> +#endif
>>
>> #ifdef COMPARE_WITH_FNMATCH
>> #include <fnmatch.h>
>>
>> -int fnmatch_errors = 0;
>> +static int fnmatch_errors = 0;
>> #endif
>>
>> -int wildmatch_errors = 0;
>> -char number_separator = ',';
>> +static int wildmatch_errors = 0;
>>
>> typedef char bool;
>>
>> -int output_iterations = 0;
>> -int explode_mod = 0;
>> -int empties_mod = 0;
>> -int empty_at_start = 0;
>> -int empty_at_end = 0;
>> -
>> -static struct poptOption long_options[] = {
>> - /* longName, shortName, argInfo, argPtr, value, descrip, argDesc
>> */
>> - {"iterations", 'i', POPT_ARG_NONE, &output_iterations, 0,
>> 0, 0},
>> - {"empties", 'e', POPT_ARG_STRING, 0, 'e', 0, 0},
>> - {"explode", 'x', POPT_ARG_INT, &explode_mod, 0, 0, 0},
>> - {0,0,0,0, 0, 0, 0}
>> +static int explode_mod = 0;
> Isn't static variables like this initialized to zero by default? There
> is a high chance that I might be wrong though.
C99,
5.1.2.1: All objects with static storage duration shall be initialized (set
to their initial values) before program startup.
6.2.4.2: An object whose identifier is declared with external or internal
linkage, or with the storage-class specifier static has static storage
duration. Its lifetime is the entire execution of the program and its stored
value is initialized only once, prior to program startup.
6.7.8.10: If an object that has automatic storage duration is not
initialized explicitly, its value is indeterminate. If an object that has
static storage duration is not initialized explicitly, then:
— if it has pointer type, it is initialized to a null pointer;
— if it has arithmetic type, it is initialized to (positive or unsigned)
zero;
— if it is an aggregate, every member is initialized (recursively) according
to these rules;
— if it is a union, the first named member is initialized (recursively)
according to these rules.
So seems you're right ;-)
next prev parent reply other threads:[~2012-10-06 9:31 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-05 4:40 [PATCH 00/10] nd/wildmatch take 2 Nguyễn Thái Ngọc Duy
2012-10-05 4:41 ` [PATCH 01/10] gitignore: make pattern parsing code a separate function Nguyễn Thái Ngọc Duy
2012-10-05 4:41 ` [PATCH 02/10] attr: avoid strlen() on every match Nguyễn Thái Ngọc Duy
2012-10-05 4:41 ` [PATCH 03/10] attr: avoid searching for basename " Nguyễn Thái Ngọc Duy
2012-10-05 4:41 ` [PATCH 04/10] attr: more matching optimizations from .gitignore Nguyễn Thái Ngọc Duy
2012-10-05 18:48 ` Junio C Hamano
2012-10-06 5:02 ` Nguyen Thai Ngoc Duy
2012-10-06 5:36 ` Junio C Hamano
2012-10-06 6:43 ` Nguyen Thai Ngoc Duy
2012-10-06 6:59 ` Junio C Hamano
2012-10-08 3:26 ` Nguyen Thai Ngoc Duy
2012-10-08 15:50 ` Junio C Hamano
2012-10-05 4:41 ` [PATCH 05/10] Import wildmatch from rsync Nguyễn Thái Ngọc Duy
2012-10-05 10:30 ` Peter Krefting
2012-10-05 11:18 ` Nguyen Thai Ngoc Duy
2012-10-05 4:41 ` [PATCH 06/10] wildmatch: remove static variable force_lower_case Nguyễn Thái Ngọc Duy
2012-10-05 4:41 ` [PATCH 07/10] wildmatch: fix case-insensitive matching Nguyễn Thái Ngọc Duy
2012-10-05 4:41 ` [PATCH 08/10] Integrate wildmatch to git Nguyễn Thái Ngọc Duy
2012-10-05 21:20 ` Thiago Farina
2012-10-06 9:25 ` Joachim Schmitz [this message]
2012-10-05 4:41 ` [PATCH 09/10] Support "**" in .gitignore and .gitattributes patterns using wildmatch() Nguyễn Thái Ngọc Duy
2012-10-05 4:41 ` [PATCH 10/10] gitignore: forbid "abc**def" Nguyễn Thái Ngọc Duy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='k4otes$jll$1@ger.gmane.org' \
--to=jojo@schmitz-digital.de \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.