mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 18:22:07 +00:00
Refactor !!x to x != 0
Also limit comments and docs to single "!"s
This commit is contained in:
@@ -10,7 +10,7 @@
|
||||
#ifndef RGBDS_LINK_SECTION_H
|
||||
#define RGBDS_LINK_SECTION_H
|
||||
|
||||
// GUIDELINE: external code MUST NOT BE AWARE of the data structure used!!
|
||||
// GUIDELINE: external code MUST NOT BE AWARE of the data structure used!
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#ifndef RGBDS_LINK_SYMBOL_H
|
||||
#define RGBDS_LINK_SYMBOL_H
|
||||
|
||||
// GUIDELINE: external code MUST NOT BE AWARE of the data structure used!!
|
||||
// GUIDELINE: external code MUST NOT BE AWARE of the data structure used!
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
|
||||
@@ -1327,7 +1327,7 @@ Note also that only exported symbols will appear in symbol and map files produce
|
||||
.Ss Purging symbols
|
||||
.Ic PURGE
|
||||
allows you to completely remove a symbol from the symbol table as if it had never existed.
|
||||
.Em USE WITH EXTREME CAUTION!!!
|
||||
.Em USE WITH EXTREME CAUTION!
|
||||
I can't stress this enough,
|
||||
.Sy you seriously need to know what you are doing .
|
||||
DON'T purge a symbol that you use in expressions the linker needs to calculate.
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
struct Charnode {
|
||||
bool isTerminal; // Whether there exists a mapping that ends here
|
||||
uint8_t value; // If the above is true, its corresponding value
|
||||
// This MUST be indexes and not pointers, because pointers get invalidated by `realloc`!!
|
||||
// This MUST be indexes and not pointers, because pointers get invalidated by `realloc`!
|
||||
size_t next[255]; // Indexes of where to go next, 0 = nowhere
|
||||
};
|
||||
|
||||
|
||||
@@ -249,7 +249,7 @@ void fmt_PrintNumber(char *buf, size_t bufLen, struct FormatSpec const *fmt, uin
|
||||
}
|
||||
|
||||
size_t len = strlen(valueBuf);
|
||||
size_t numLen = !!sign + !!prefix + len;
|
||||
size_t numLen = (sign != 0) + (prefix != 0) + len;
|
||||
size_t totalLen = fmt->width > numLen ? fmt->width : numLen;
|
||||
|
||||
if (totalLen > bufLen - 1) { // bufLen includes terminator
|
||||
|
||||
@@ -291,7 +291,7 @@ bool yywrap(void)
|
||||
}
|
||||
|
||||
// Make sure not to switch the lexer state before calling this, so the saved line no is correct.
|
||||
// BE CAREFUL!! This modifies the file stack directly, you should have set up the file info first.
|
||||
// BE CAREFUL! This modifies the file stack directly, you should have set up the file info first.
|
||||
// Callers should set contextStack->lexerState after this so it is not NULL.
|
||||
static void newContext(struct FileStackNode *fileInfo)
|
||||
{
|
||||
@@ -313,7 +313,7 @@ static void newContext(struct FileStackNode *fileInfo)
|
||||
context->forName = NULL;
|
||||
|
||||
// Link new entry to its parent so it's reachable later
|
||||
// ERRORS SHOULD NOT OCCUR AFTER THIS!!
|
||||
// ERRORS SHOULD NOT OCCUR AFTER THIS!
|
||||
context->parent = contextStack;
|
||||
contextStack = context;
|
||||
}
|
||||
|
||||
@@ -101,7 +101,7 @@ static char const *Callback__FILE__(void)
|
||||
// Account for the extra backslash inserted below
|
||||
if (fileName[i] == '"')
|
||||
j++;
|
||||
// Ensure there will be enough room; DO NOT PRINT ANYTHING ABOVE THIS!!
|
||||
// Ensure there will be enough room; DO NOT PRINT ANYTHING ABOVE THIS!
|
||||
if (j + 2 >= bufsize) { // Always keep room for 2 tail chars
|
||||
bufsize = bufsize ? bufsize * 2 : 64;
|
||||
buf = realloc(buf, bufsize);
|
||||
@@ -590,7 +590,7 @@ struct Symbol *sym_AddAnonLabel(void)
|
||||
}
|
||||
char name[MAXSYMLEN + 1];
|
||||
|
||||
sym_WriteAnonLabelName(name, 0, true); // The direction is important!!
|
||||
sym_WriteAnonLabelName(name, 0, true); // The direction is important!
|
||||
anonLabelID++;
|
||||
return addLabel(name);
|
||||
}
|
||||
|
||||
@@ -146,7 +146,7 @@ static int32_t computeRPNExpr(struct Patch const *patch,
|
||||
isError = false;
|
||||
|
||||
// Be VERY careful with two `popRPN` in the same expression.
|
||||
// C does not guarantee order of evaluation of operands!!
|
||||
// C does not guarantee order of evaluation of operands!
|
||||
// So, if there are two `popRPN` in the same expression, make
|
||||
// sure the operation is commutative.
|
||||
switch (command) {
|
||||
|
||||
Reference in New Issue
Block a user