Use nullptr where possible instead of NULL or 0

This commit is contained in:
Johannes Kauffmann 2022-11-22 19:09:31 +01:00 committed by Jeremy Hayes
parent 728c689574
commit a7603c132d
38 changed files with 248 additions and 248 deletions

View file

@ -74,7 +74,7 @@ namespace glslang {
class TAllocation {
public:
TAllocation(size_t size, unsigned char* mem, TAllocation* prev = 0) :
TAllocation(size_t size, unsigned char* mem, TAllocation* prev = nullptr) :
size(size), mem(mem), prevAlloc(prev) {
// Allocations are bracketed:
// [allocationHeader][initialGuardBlock][userData][finalGuardBlock]
@ -171,7 +171,7 @@ public:
void popAll();
//
// Call allocate() to actually acquire memory. Returns 0 if no memory
// Call allocate() to actually acquire memory. Returns nullptr if no memory
// available, otherwise a properly aligned pointer to 'numBytes' of memory.
//
void* allocate(size_t numBytes);
@ -189,7 +189,7 @@ protected:
struct tHeader {
tHeader(tHeader* nextPage, size_t pageCount) :
#ifdef GUARD_BLOCKS
lastAllocation(0),
lastAllocation(nullptr),
#endif
nextPage(nextPage), pageCount(pageCount) { }

View file

@ -58,9 +58,9 @@ class TShHandleBase {
public:
TShHandleBase() { pool = new glslang::TPoolAllocator; }
virtual ~TShHandleBase() { delete pool; }
virtual TCompiler* getAsCompiler() { return 0; }
virtual TLinker* getAsLinker() { return 0; }
virtual TUniformMap* getAsUniformMap() { return 0; }
virtual TCompiler* getAsCompiler() { return nullptr; }
virtual TLinker* getAsLinker() { return nullptr; }
virtual TUniformMap* getAsUniformMap() { return nullptr; }
virtual glslang::TPoolAllocator* getPool() const { return pool; }
private:
glslang::TPoolAllocator* pool;
@ -123,11 +123,11 @@ public:
infoSink(iSink),
executable(e),
haveReturnableObjectCode(false),
appAttributeBindings(0),
fixedAttributeBindings(0),
excludedAttributes(0),
appAttributeBindings(nullptr),
fixedAttributeBindings(nullptr),
excludedAttributes(nullptr),
excludedCount(0),
uniformBindings(0) { }
uniformBindings(nullptr) { }
virtual TLinker* getAsLinker() { return this; }
virtual ~TLinker() { }
virtual bool link(TCompilerList&, TUniformMap*) = 0;
@ -137,7 +137,7 @@ public:
virtual void getAttributeBindings(ShBindingTable const **t) const = 0;
virtual void setExcludedAttributes(const int* attributes, int count) { excludedAttributes = attributes; excludedCount = count; }
virtual ShBindingTable* getUniformBindings() const { return uniformBindings; }
virtual const void* getObjectCode() const { return 0; } // a real compiler would be returning object code here
virtual const void* getObjectCode() const { return nullptr; } // a real compiler would be returning object code here
virtual TInfoSink& getInfoSink() { return infoSink; }
TInfoSink& infoSink;
protected:

View file

@ -1086,31 +1086,31 @@ public:
virtual const glslang::TSourceLoc& getLoc() const { return loc; }
virtual void setLoc(const glslang::TSourceLoc& l) { loc = l; }
virtual void traverse(glslang::TIntermTraverser*) = 0;
virtual glslang::TIntermTyped* getAsTyped() { return 0; }
virtual glslang::TIntermOperator* getAsOperator() { return 0; }
virtual glslang::TIntermConstantUnion* getAsConstantUnion() { return 0; }
virtual glslang::TIntermAggregate* getAsAggregate() { return 0; }
virtual glslang::TIntermUnary* getAsUnaryNode() { return 0; }
virtual glslang::TIntermBinary* getAsBinaryNode() { return 0; }
virtual glslang::TIntermSelection* getAsSelectionNode() { return 0; }
virtual glslang::TIntermSwitch* getAsSwitchNode() { return 0; }
virtual glslang::TIntermMethod* getAsMethodNode() { return 0; }
virtual glslang::TIntermSymbol* getAsSymbolNode() { return 0; }
virtual glslang::TIntermBranch* getAsBranchNode() { return 0; }
virtual glslang::TIntermLoop* getAsLoopNode() { return 0; }
virtual glslang::TIntermTyped* getAsTyped() { return nullptr; }
virtual glslang::TIntermOperator* getAsOperator() { return nullptr; }
virtual glslang::TIntermConstantUnion* getAsConstantUnion() { return nullptr; }
virtual glslang::TIntermAggregate* getAsAggregate() { return nullptr; }
virtual glslang::TIntermUnary* getAsUnaryNode() { return nullptr; }
virtual glslang::TIntermBinary* getAsBinaryNode() { return nullptr; }
virtual glslang::TIntermSelection* getAsSelectionNode() { return nullptr; }
virtual glslang::TIntermSwitch* getAsSwitchNode() { return nullptr; }
virtual glslang::TIntermMethod* getAsMethodNode() { return nullptr; }
virtual glslang::TIntermSymbol* getAsSymbolNode() { return nullptr; }
virtual glslang::TIntermBranch* getAsBranchNode() { return nullptr; }
virtual glslang::TIntermLoop* getAsLoopNode() { return nullptr; }
virtual const glslang::TIntermTyped* getAsTyped() const { return 0; }
virtual const glslang::TIntermOperator* getAsOperator() const { return 0; }
virtual const glslang::TIntermConstantUnion* getAsConstantUnion() const { return 0; }
virtual const glslang::TIntermAggregate* getAsAggregate() const { return 0; }
virtual const glslang::TIntermUnary* getAsUnaryNode() const { return 0; }
virtual const glslang::TIntermBinary* getAsBinaryNode() const { return 0; }
virtual const glslang::TIntermSelection* getAsSelectionNode() const { return 0; }
virtual const glslang::TIntermSwitch* getAsSwitchNode() const { return 0; }
virtual const glslang::TIntermMethod* getAsMethodNode() const { return 0; }
virtual const glslang::TIntermSymbol* getAsSymbolNode() const { return 0; }
virtual const glslang::TIntermBranch* getAsBranchNode() const { return 0; }
virtual const glslang::TIntermLoop* getAsLoopNode() const { return 0; }
virtual const glslang::TIntermTyped* getAsTyped() const { return nullptr; }
virtual const glslang::TIntermOperator* getAsOperator() const { return nullptr; }
virtual const glslang::TIntermConstantUnion* getAsConstantUnion() const { return nullptr; }
virtual const glslang::TIntermAggregate* getAsAggregate() const { return nullptr; }
virtual const glslang::TIntermUnary* getAsUnaryNode() const { return nullptr; }
virtual const glslang::TIntermBinary* getAsBinaryNode() const { return nullptr; }
virtual const glslang::TIntermSelection* getAsSelectionNode() const { return nullptr; }
virtual const glslang::TIntermSwitch* getAsSwitchNode() const { return nullptr; }
virtual const glslang::TIntermMethod* getAsMethodNode() const { return nullptr; }
virtual const glslang::TIntermSymbol* getAsSymbolNode() const { return nullptr; }
virtual const glslang::TIntermBranch* getAsBranchNode() const { return nullptr; }
virtual const glslang::TIntermLoop* getAsLoopNode() const { return nullptr; }
virtual ~TIntermNode() { }
protected:
@ -1616,8 +1616,8 @@ protected:
//
class TIntermUnary : public TIntermOperator {
public:
TIntermUnary(TOperator o, TType& t) : TIntermOperator(o, t), operand(0) {}
TIntermUnary(TOperator o) : TIntermOperator(o), operand(0) {}
TIntermUnary(TOperator o, TType& t) : TIntermOperator(o, t), operand(nullptr) {}
TIntermUnary(TOperator o) : TIntermOperator(o), operand(nullptr) {}
virtual void traverse(TIntermTraverser*);
virtual void setOperand(TIntermTyped* o) { operand = o; }
virtual TIntermTyped* getOperand() { return operand; }
@ -1819,7 +1819,7 @@ public:
TIntermNode *getParentNode()
{
return path.size() == 0 ? NULL : path.back();
return path.size() == 0 ? nullptr : path.back();
}
const bool preVisit;