Skip to content

Commit cea36d3

Browse files
authored
Merge pull request #4328 from masatake/misc-fixes
Misc fixes
2 parents 3ce289e + c281930 commit cea36d3

File tree

11 files changed

+67
-16
lines changed

11 files changed

+67
-16
lines changed

Tmain/map-removing.d/run.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,3 +49,18 @@ ${CTAGS} --quiet --options=NONE \
4949
--guess-language-eagerly \
5050
ada.m matlab.m objc.m
5151
echo
52+
53+
X=xxxyyyzzz
54+
echo 'Removing multi extension entries'
55+
${CTAGS} --quiet --options=NONE \
56+
--map-Pascal=.$X \
57+
--map-Fortran=.$X \
58+
--langmap=C:.$X \
59+
--list-maps | grep $X
60+
61+
echo 'Removing multi pattern entries'
62+
${CTAGS} --quiet --options=NONE \
63+
--map-Pascal='('$X')' \
64+
--map-Fortran='('$X')' \
65+
--langmap=C:'('$X')' \
66+
--list-maps | grep $X

Tmain/map-removing.d/stdout-expected.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,7 @@ ada.m: Ada
3030
matlab.m: MatLab
3131
objc.m: ObjectiveC
3232

33+
Removing multi extension entries
34+
C *.xxxyyyzzz
35+
Removing multi pattern entries
36+
C xxxyyyzzz

docs/man/ctags.1.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1060,7 +1060,7 @@ Listing Options
10601060
``TAG_OUTPUT_VERSION`` in :ref:`ctags-client-tools(7) <ctags-client-tools(7)>` about the ctags output
10611061
version.
10621062

1063-
(since verison 6.3.0)
1063+
(since version 6.3.0)
10641064

10651065
DESCRIPTION
10661066
Human readable description for the extra.
@@ -1115,7 +1115,7 @@ Listing Options
11151115
``TAG_OUTPUT_VERSION`` in :ref:`ctags-client-tools(7) <ctags-client-tools(7)>` about the ctags output
11161116
version.
11171117

1118-
(since verison 6.3.0)
1118+
(since version 6.3.0)
11191119

11201120
DESCRIPTION
11211121
Human readable description for the field.
@@ -1213,7 +1213,7 @@ Listing Options
12131213
VER
12141214
The parser version introducing the kind.
12151215

1216-
(since verison 6.3.0)
1216+
(since version 6.3.0)
12171217

12181218
DESCRIPTION
12191219
Human readable description for the kind.
@@ -1267,7 +1267,7 @@ Listing Options
12671267
``NULLTAG`` column represetns whether the format supports *null tags* or
12681268
not. See ``nulltag``/``z`` in "`Extras`_" about the null tags.
12691269

1270-
(since verison 6.2.0)
1270+
(since version 6.2.0)
12711271

12721272
``--list-params[=(<language>|all)]``
12731273
Lists the parameters for either the specified *<language>* or ``all``
@@ -1307,7 +1307,7 @@ Listing Options
13071307
VER
13081308
The parser version introducing the role.
13091309

1310-
(since verison 6.3.0)
1310+
(since version 6.3.0)
13111311

13121312
DESCRIPTION
13131313
Human readable description for the role.
@@ -1334,7 +1334,7 @@ Miscellaneous Options
13341334
``--describe-language=<language>``
13351335
Prints the various aspects of the parser implementing the language.
13361336

1337-
(since verison 6.3.0)
1337+
(since version 6.3.0)
13381338

13391339
``--help``
13401340
Prints to standard output a detailed usage description, and then exits.

extra-cmds/utiltest.c

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include "intern.h"
1414
#include "numarray.h"
1515
#include "routines.h"
16+
#include "routines_p.h"
1617
#include "vstring.h"
1718
#include <string.h>
1819

@@ -277,6 +278,31 @@ static void test_routines_strrstr(void)
277278
TEST_CHECK(strcmp(strrstr("abcdcdb", "cd"), "cdb") == 0);
278279
}
279280

281+
static void test_routines_baseFilenameSansExtensionNew(void)
282+
{
283+
char *bs;
284+
285+
TEST_CHECK ((bs = baseFilenameSansExtensionNew ("a.in", ".in"))
286+
&& strcmp(bs, "a") == 0);
287+
if (bs)
288+
eFree (bs);
289+
290+
TEST_CHECK ((bs = baseFilenameSansExtensionNew ("x/b.in", ".in"))
291+
&& strcmp(bs, "b") == 0);
292+
if (bs)
293+
eFree (bs);
294+
295+
TEST_CHECK ((bs = baseFilenameSansExtensionNew ("c.in.in", ".in.in"))
296+
&& strcmp(bs, "c") == 0);
297+
if (bs)
298+
eFree (bs);
299+
300+
TEST_CHECK ((bs = baseFilenameSansExtensionNew ("/y/d.in.in", ".in.in"))
301+
&& strcmp(bs, "d") == 0);
302+
if (bs)
303+
eFree (bs);
304+
}
305+
280306
static void test_vstring_ncats(void)
281307
{
282308
vString *vstr = vStringNew ();
@@ -351,6 +377,7 @@ TEST_LIST = {
351377
{ "intern", test_intern },
352378
{ "numarray", test_numarray },
353379
{ "routines/strrstr", test_routines_strrstr },
380+
{ "routines/baseFilenameSansExtensionNew", test_routines_baseFilenameSansExtensionNew },
354381
{ "vstring/ncats", test_vstring_ncats },
355382
{ "vstring/truncate_leading", test_vstring_truncate_leading },
356383
{ "vstring/EqC", test_vstring_eqc },

main/lregex-default.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ static regexCompiledCode compile (struct regexBackend *backend,
106106
if (errcode != 0)
107107
{
108108
char errmsg[256];
109-
regerror (errcode, regex_code, errmsg, 256);
109+
regerror (errcode, regex_code, errmsg, sizeof(errmsg));
110110
error (WARNING, "regcomp: %s", errmsg);
111111
regfree (regex_code);
112112
eFree (regex_code);

main/parse.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1740,7 +1740,7 @@ extern bool removeLanguagePatternMap (const langType language, const char *const
17401740
if (language == LANG_AUTO)
17411741
{
17421742
unsigned int i;
1743-
for (i = 0 ; i < LanguageCount && ! result ; ++i)
1743+
for (i = 0 ; i < LanguageCount ; ++i)
17441744
result = removeLanguagePatternMap1 (i, pattern) || result;
17451745
}
17461746
else

main/routines.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -664,7 +664,7 @@ extern char* baseFilenameSansExtensionNew (const char *const fileName,
664664
const char *const base = baseFilename (fileName);
665665
char* shorten_base;
666666

667-
pDelimiter = strrchr (base, templateExt[0]);
667+
pDelimiter = strrstr (base, templateExt);
668668

669669
if (pDelimiter && (strcmp (pDelimiter, templateExt) == 0))
670670
{

main/writer.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,18 @@ extern tagWriter uCtagsWriter;
2121
extern tagWriter eCtagsWriter;
2222
extern tagWriter etagsWriter;
2323
extern tagWriter xrefWriter;
24+
#ifdef HAVE_JANSSON
2425
extern tagWriter jsonWriter;
26+
#endif
2527

2628
static tagWriter *writerTable [WRITER_COUNT] = {
2729
[WRITER_U_CTAGS] = &uCtagsWriter,
2830
[WRITER_E_CTAGS] = &eCtagsWriter,
2931
[WRITER_ETAGS] = &etagsWriter,
3032
[WRITER_XREF] = &xrefWriter,
33+
#ifdef HAVE_JANSSON
3134
[WRITER_JSON] = &jsonWriter,
35+
#endif
3236
[WRITER_CUSTOM] = NULL,
3337
};
3438

main/writer_p.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ typedef enum eWriterType {
2727
WRITER_E_CTAGS,
2828
WRITER_ETAGS,
2929
WRITER_XREF,
30+
#ifdef HAVE_JANSSON
3031
WRITER_JSON,
32+
#endif
3133
WRITER_CUSTOM,
3234
WRITER_COUNT,
3335
} writerType;

man/ctags.1.rst.in

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1060,7 +1060,7 @@ Listing Options
10601060
``TAG_OUTPUT_VERSION`` in ctags-client-tools(7) about the ctags output
10611061
version.
10621062

1063-
(since verison 6.3.0)
1063+
(since version 6.3.0)
10641064

10651065
DESCRIPTION
10661066
Human readable description for the extra.
@@ -1115,7 +1115,7 @@ Listing Options
11151115
``TAG_OUTPUT_VERSION`` in ctags-client-tools(7) about the ctags output
11161116
version.
11171117

1118-
(since verison 6.3.0)
1118+
(since version 6.3.0)
11191119

11201120
DESCRIPTION
11211121
Human readable description for the field.
@@ -1213,7 +1213,7 @@ Listing Options
12131213
VER
12141214
The parser version introducing the kind.
12151215

1216-
(since verison 6.3.0)
1216+
(since version 6.3.0)
12171217

12181218
DESCRIPTION
12191219
Human readable description for the kind.
@@ -1267,7 +1267,7 @@ Listing Options
12671267
``NULLTAG`` column represetns whether the format supports *null tags* or
12681268
not. See ``nulltag``/``z`` in "`Extras`_" about the null tags.
12691269

1270-
(since verison 6.2.0)
1270+
(since version 6.2.0)
12711271

12721272
``--list-params[=(<language>|all)]``
12731273
Lists the parameters for either the specified *<language>* or ``all``
@@ -1307,7 +1307,7 @@ Listing Options
13071307
VER
13081308
The parser version introducing the role.
13091309

1310-
(since verison 6.3.0)
1310+
(since version 6.3.0)
13111311

13121312
DESCRIPTION
13131313
Human readable description for the role.
@@ -1334,7 +1334,7 @@ Miscellaneous Options
13341334
``--describe-language=<language>``
13351335
Prints the various aspects of the parser implementing the language.
13361336

1337-
(since verison 6.3.0)
1337+
(since version 6.3.0)
13381338

13391339
``--help``
13401340
Prints to standard output a detailed usage description, and then exits.

0 commit comments

Comments
 (0)