[Github-comments] [geany/geany] ctags: boolean to C99 bool conversion and vStringTerminate() removal (#1251)
Colomban Wendling
notifications at xxxxx
Sun Oct 2 09:01:13 UTC 2016
b4n requested changes on this pull request.
I didn't review the changes on U-CTags side, so some comments might be slightly irrelevant (e.g. alignment, while nice, doesn't make much sense if it's not kept on U-CTags side), or on the contrary relevant to apply to U-CTags.
> unsigned long lineNumber; /* line number of tag */
MIOPos filePosition; /* file position of line containing tag */
const char* language; /* language of source file */
- boolean isFileScope; /* is tag visible only within source file? */
- boolean isFileEntry; /* is this just an entry for a file name? */
- boolean truncateLine; /* truncate tag line at end of tag name? */
+ bool isFileScope; /* is tag visible only within source file? */
+ bool isFileEntry; /* is this just an entry for a file name? */
+ bool truncateLine; /* truncate tag line at end of tag name? */
maybe keep alignment
> @@ -46,7 +46,7 @@
# include <sys/types.h> /* required by dirent.h */
# endif
# include <dirent.h> /* to declare opendir() */
-# undef boolean
+# undef bool
as @codebrainz pointed out, that's not good as the C standard explicitly states that `bool` is a macro. So while here this probably restored the `typedef` from *general.h*, now it removes any definition.
I think it must be safe to drop this `undef` altogether, as *stdbool.h* being standard there's no reason for *dirent.h* to mess it up.
> @@ -225,8 +225,8 @@ MIO *mio_new_memory (unsigned char *data,
mio->impl.mem.allocated_size = size;
mio->impl.mem.realloc_func = realloc_func;
mio->impl.mem.free_func = free_func;
- mio->impl.mem.eof = FALSE;
- mio->impl.mem.error = FALSE;
+ mio->impl.mem.eof = false;
+ mio->impl.mem.error = false;
(I definitely need to do something about MIO sync)
> } extensionFields;
stringList* ignore; /* -I name of file containing tokens to ignore */
- boolean append; /* -a append to "tags" file */
- boolean backward; /* -B regexp patterns search backwards */
+ bool append; /* -a append to "tags" file */
+ bool backward; /* -B regexp patterns search backwards */
comment alignment? :) (continues below)
> @@ -71,7 +71,7 @@ typedef struct {
/* used internally */
unsigned int id; /* id assigned to language */
- boolean enabled; /* currently enabled? */
+ bool enabled; /* currently enabled? */
alignment
> @@ -294,10 +294,10 @@ extern boolean fileOpen (const char *const fileName, const langType language)
* This func is NOT THREAD SAFE.
* The user should not tamper with the buffer while this func is executing.
*/
-extern boolean bufferOpen (unsigned char *buffer, size_t buffer_size,
+extern bool bufferOpen (unsigned char *buffer, size_t buffer_size,
const char *const fileName, const langType language )
parenthesis alignment (ok, it's not very visible here)
> @@ -113,7 +113,7 @@ extern void ungetcToInputFile (int c);
extern const unsigned char *readLineFromInputFile (void);
extern char *readLineRaw (vString *const vLine, MIO *const mio);
extern char *readSourceLine (vString *const vLine, MIOPos location, long *const pSeekValue);
-extern boolean bufferOpen (unsigned char *buffer, size_t buffer_size,
+extern bool bufferOpen (unsigned char *buffer, size_t buffer_size,
const char *const fileName, const langType language );
alignment
> @@ -103,7 +103,7 @@ static void printXtag (xtagType i)
printf((Option.machinable? "%c\t%s\t%s\t%s\n": MAKE_XTAG_FMT(c)),
xtagDescs[i].letter,
xtagDescs[i].name,
- getXtagDesc (i)->enabled? "TRUE": "FALSE",
+ getXtagDesc (i)->enabled? "true": "false",
that's probably wrong
> @@ -404,7 +404,7 @@ static const keywordDesc KeywordTable [] = {
{ "bind_var", KEYWORD_BIND_VAR, { 0, 0, 0, 0, 1, 0, 0 } },
{ "bit", KEYWORD_BIT, { 0, 0, 0, 0, 1, 0, 0 } },
{ "body", KEYWORD_BODY, { 0, 0, 0, 0, 0, 0, 1 } },
- { "boolean", KEYWORD_BOOLEAN, { 0, 0, 0, 1, 0, 0, 0 } },
+ { "bool", KEYWORD_BOOLEAN, { 0, 0, 0, 1, 0, 0, 0 } },
Nope!
> @@ -689,7 +689,7 @@ static const char *implementationString (const impType imp)
#ifdef DEBUG
-#define boolString(c) ((c) ? "TRUE" : "FALSE")
+#define boolString(c) ((c) ? "true" : "false")
this should probably be left out (although well, it's only used in debugging output, so doesn't matter so much)
> else if (isType (token, TOKEN_BRACE_CLOSE))
/* Java, D, C#, Vala do not require semicolons to end a block. Neither do
* C++ namespaces. All other blocks require a semicolon to terminate them.
*/
- isEnd = (boolean) (isInputLanguage (Lang_java) || isInputLanguage (Lang_d) ||
+ isEnd = (bool) (isInputLanguage (Lang_java) || isInputLanguage (Lang_d) ||
isInputLanguage (Lang_csharp) || isInputLanguage (Lang_vala) ||
! isContextualStatement (st));
alignment
> @@ -70,12 +70,12 @@ typedef enum {
static langType Lang_json;
static kindOption JsonKinds [] = {
- { TRUE, 'o', "object", "objects" },
- { TRUE, 'a', "array", "arrays" },
- { TRUE, 'n', "number", "numbers" },
- { TRUE, 's', "string", "strings" },
- { TRUE, 'b', "boolean", "booleans" },
- { TRUE, 'z', "null", "nulls" }
+ { true, 'o', "object", "objects" },
+ { true, 'a', "array", "arrays" },
+ { true, 'n', "number", "numbers" },
+ { true, 's', "string", "strings" },
+ { true, 'b', "bool", "booleans" },
not the string
> @@ -87,7 +87,7 @@ static boolean isTxt2tagsLine (const unsigned char *line)
return len >= 20 && *line == 0;
}
-static boolean parseTxt2tagsTitle (const unsigned char *line,
+static bool parseTxt2tagsTitle (const unsigned char *line,
vString *const title,
int *const depth_)
alignment
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany/pull/1251#pullrequestreview-2445607
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.geany.org/pipermail/github-comments/attachments/20161002/0f10dd14/attachment.html>
More information about the Github-comments
mailing list