Skip to content

Commit

Permalink
nullptr
Browse files Browse the repository at this point in the history
  • Loading branch information
JarrettSJohnson committed May 20, 2024
1 parent 74ffc07 commit 947e208
Show file tree
Hide file tree
Showing 122 changed files with 2,654 additions and 2,654 deletions.
6 changes: 3 additions & 3 deletions layer0/Crystal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Z* -------------------------------------------------------------------

PyObject *CrystalAsPyList(const CCrystal * I)
{
PyObject *result = NULL;
PyObject *result = nullptr;

if(I) {
result = PyList_New(2);
Expand All @@ -45,7 +45,7 @@ int CrystalFromPyList(CCrystal * I, PyObject * list)
int ok = true, rok = true;
int ll = 0;
if(ok)
ok = (I != NULL);
ok = (I != nullptr);
if(ok)
ok = PyList_Check(list);
if(ok)
Expand Down Expand Up @@ -116,7 +116,7 @@ CGO *CrystalGetUnitCellCGO(const CCrystal * I)
{
PyMOLGlobals *G = I->G;
float v[3];
CGO *cgo = NULL;
CGO *cgo = nullptr;

auto const ucv = SettingGet<bool>(G, cSetting_cell_centered)
? unitCellVerticesCentered
Expand Down
10 changes: 5 additions & 5 deletions layer0/Field.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ PyObject *FieldAsNumPyArray(CField * field, short copy)
{
#ifndef _PYMOL_NUMPY
printf("No numpy support\n");
return NULL;
return nullptr;
#else

PyObject *result;
Expand Down Expand Up @@ -65,7 +65,7 @@ PyObject *FieldAsNumPyArray(CField * field, short copy)
if(typenum == -1) {
printf("error: no typenum for type %d and base_size %d\n",
field->type, field->base_size);
return NULL;
return nullptr;
}

auto dims = pymol::malloc<npy_intp>(field->n_dim());
Expand All @@ -82,13 +82,13 @@ PyObject *FieldAsNumPyArray(CField * field, short copy)
return result;
ok_except1:
printf("FieldAsNumPyArray failed\n");
return NULL;
return nullptr;
#endif
}

PyObject *FieldAsPyList(PyMOLGlobals * G, CField * I)
{
PyObject *result = NULL;
PyObject *result = nullptr;
int n_elem;

int pse_export_version = SettingGetGlobal_f(G, cSetting_pse_export_version) * 1000;
Expand Down Expand Up @@ -137,7 +137,7 @@ CField *FieldNewFromPyList(PyMOLGlobals * G, PyObject * list)
auto I = new CField();

if(ok)
ok = (list != NULL);
ok = (list != nullptr);
if(ok)
ok = PyList_Check(list);
if(ok)
Expand Down
6 changes: 3 additions & 3 deletions layer0/File.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ static long fgetsize(FILE *fp) {

/**
* Allocate memory and read the entire file from the given file pointer.
* The file size is stored into the size pointer if not NULL.
* The file size is stored into the size pointer if not nullptr.
*/
static char * fgetcontents(FILE *fp, long *size) {
long filesize = fgetsize(fp);
Expand Down Expand Up @@ -66,7 +66,7 @@ FILE * pymol_fopen(const char * filename, const char * mode) {

if (!MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS,
filename, len_filename, wfilename.data(), wfilename.size()))
return NULL;
return nullptr;

fp = _wfopen(wfilename.data(), wmode.data());
}
Expand All @@ -77,7 +77,7 @@ FILE * pymol_fopen(const char * filename, const char * mode) {

/**
* Allocate memory and read the entire file for the given filename.
* The file size is stored into the size pointer if not NULL.
* The file size is stored into the size pointer if not nullptr.
*/
char * FileGetContents(const char *filename, long *size) {
char *contents;
Expand Down
2 changes: 1 addition & 1 deletion layer0/GraphicsUtil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ bool glCheckOkay() {
/**
* GL debugging callback - enable with "pymol --gldebug"
*
* glDebugMessageCallback(gl_debug_proc, NULL);
* glDebugMessageCallback(gl_debug_proc, nullptr);
* glEnable(GL_DEBUG_OUTPUT);
*/
void GLAPIENTRY gl_debug_proc(
Expand Down
42 changes: 21 additions & 21 deletions layer0/Isosurf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,14 +97,14 @@ static void _IsosurfFree(CIsosurf * I)
void IsosurfFree(PyMOLGlobals * G)
{
_IsosurfFree(G->Isosurf);
G->Isosurf = NULL;
G->Isosurf = nullptr;
}


/*===========================================================================*/
PyObject *IsosurfAsPyList(PyMOLGlobals * G, Isofield * field)
{
PyObject *result = NULL;
PyObject *result = nullptr;

result = PyList_New(4);

Expand Down Expand Up @@ -139,9 +139,9 @@ Isofield *IsosurfNewFromPyList(PyMOLGlobals * G, PyObject * list)
int dim4[4];
int a;

Isofield *result = NULL;
Isofield *result = nullptr;
if(ok)
ok = (list != NULL);
ok = (list != nullptr);
if(ok)
ok = PyList_Check(list);
/* TO ENABLE BACKWARDS COMPATIBILITY...
Expand Down Expand Up @@ -395,10 +395,10 @@ static CIsosurf *IsosurfNew(PyMOLGlobals * G)
int c;
CIsosurf *I = pymol::calloc<CIsosurf>(1);
I->G = G;
I->VertexCodes = NULL;
I->ActiveEdges = NULL;
I->Point = NULL;
I->Line = NULL;
I->VertexCodes = nullptr;
I->ActiveEdges = nullptr;
I->Point = nullptr;
I->Line = nullptr;
I->Skip = 0;
for(c = 0; c < 256; c++)
I->Code[c] = -1;
Expand Down Expand Up @@ -1040,13 +1040,13 @@ static int IsosurfGradients(PyMOLGlobals * G, CSetting * set1, CSetting * set2,
CField *points = field->points.get();

/* flags marking excluded regions to avoid (currently wasteful) */
int *flag = NULL;
int *flag = nullptr;

/* variable length array for recording segment paths */
int *active_cell = VLAlloc(int, 1000);

/* ordered list of coordinates for processing */
int *order = NULL;
int *order = nullptr;

int range_size; /* total points in region being drawn */
int range_dim[3]; /* dimension of drawn region */
Expand Down Expand Up @@ -1149,7 +1149,7 @@ static int IsosurfGradients(PyMOLGlobals * G, CSetting * set1, CSetting * set2,
for(pass = 0; pass < 2; pass++) { /* one pass down the gradient, one up */

int have_prev = false; /* flag & storage for previous gradient & locus */
int *prev_locus = NULL;
int *prev_locus = nullptr;

int locus[3]; /* what cell are we in? */
float fract[3] = { 0.0F, 0.0F, 0.0F }; /* where in the cell are we? */
Expand Down Expand Up @@ -1214,7 +1214,7 @@ static int IsosurfGradients(PyMOLGlobals * G, CSetting * set1, CSetting * set2,
if((!have_prev) || (have_prev && ((locus[0] != prev_locus[0]) ||
(locus[1] != prev_locus[1]) ||
(locus[2] != prev_locus[2])))) {
/* above: prev_locus may be NULL, so relying upon shortcut logic eval */
/* above: prev_locus may be nullptr, so relying upon shortcut logic eval */

/* stop if we hit a flagged cell (flag always in lower corner) */

Expand Down Expand Up @@ -1674,7 +1674,7 @@ static int IsosurfDrawLines(CIsosurf * II)
#ifdef Trace
LCount++;
#endif
Cur = NULL;
Cur = nullptr;
if(I->NLine != (*I->Num)[I->NSeg]) { /* any new lines? */
I->Num->check(I->NSeg + 1);
(*I->Num)[I->NSeg] = I->NLine - (*I->Num)[I->NSeg];
Expand Down Expand Up @@ -1736,8 +1736,8 @@ static int IsosurfFindLines(CIsosurf * II)
printf("IsosurfFindLines: bad index: %i \n", index);
#endif
while(cod > 0) {
p1 = NULL;
p2 = NULL;
p1 = nullptr;
p2 = nullptr;
switch (cod) {
case 40:
case 32:
Expand Down Expand Up @@ -1773,8 +1773,8 @@ static int IsosurfFindLines(CIsosurf * II)
break;
default:
cod = 0;
p1 = NULL;
p2 = NULL;
p1 = nullptr;
p2 = nullptr;
break;
}
if(p1 && p2) {
Expand Down Expand Up @@ -1836,8 +1836,8 @@ static int IsosurfFindLines(CIsosurf * II)
break;
default:
cod = 0;
p1 = NULL;
p2 = NULL;
p1 = nullptr;
p2 = nullptr;
break;
}
if(p1 && p2) {
Expand Down Expand Up @@ -1899,8 +1899,8 @@ static int IsosurfFindLines(CIsosurf * II)
break;
default:
cod = 0;
p1 = NULL;
p2 = NULL;
p1 = nullptr;
p2 = nullptr;
break;
}
if(p1 && p2) {
Expand Down
18 changes: 9 additions & 9 deletions layer0/ListMacros.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ Z* -------------------------------------------------------------------
#include"Err.h"
#include"Result.h"

#define ListInit(List) List = NULL
#define ListInit(List) List = nullptr

#define ListAppend(List,Elem,Link,ElemType) \
{ \
ElemType *current = (List); \
ElemType *previous = NULL; \
ElemType *previous = nullptr; \
while(current) \
{ \
previous = current; \
Expand All @@ -40,7 +40,7 @@ Z* -------------------------------------------------------------------
previous->Link = Elem; \
else \
(List) = Elem; \
(Elem)->Link = NULL; \
(Elem)->Link = nullptr; \
}

/**
Expand Down Expand Up @@ -69,7 +69,7 @@ void ListAppendT(ElemType*& list, ElemType* ele){
#define ListFree(List,Link,ElemType) \
{ \
ElemType *current = List; \
ElemType *previous = NULL; \
ElemType *previous = nullptr; \
while(current) \
{ \
if(previous) \
Expand All @@ -79,13 +79,13 @@ void ListAppendT(ElemType*& list, ElemType* ele){
} \
if(previous) \
mfree(previous); \
(List) = NULL; \
(List) = nullptr; \
}

#define ListDetach(List,Elem,Link,ElemType) \
{ \
ElemType *current = List; \
ElemType *previous = NULL; \
ElemType *previous = nullptr; \
while(current) \
{ \
if(current == (Elem)) \
Expand All @@ -99,7 +99,7 @@ void ListAppendT(ElemType*& list, ElemType* ele){
previous->Link = current->Link; \
else \
(List) = current->Link; \
(Elem)->Link = NULL; \
(Elem)->Link = nullptr; \
} \
}

Expand Down Expand Up @@ -143,7 +143,7 @@ ElemType* ListDetachT(ElemType*& list, ElemType* ele){
}

#define ListIterate(List,Counter,Link) \
( (Counter) = ((List) ? (((Counter) ? (Counter)->Link : (List))) : NULL))
( (Counter) = ((List) ? (((Counter) ? (Counter)->Link : (List))) : nullptr))


/* Elem handling routines */
Expand All @@ -166,7 +166,7 @@ ElemType* ListDetachT(ElemType*& list, ElemType* ele){
} \
}

#define ListElemFree(Elem) { mfree(Elem); Elem = NULL; }
#define ListElemFree(Elem) { mfree(Elem); Elem = nullptr; }

/**
* Retrives position of element in list
Expand Down
12 changes: 6 additions & 6 deletions layer0/Map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,7 @@ int MapSetupExpress(MapType * I)
int *link = I->Link;
int st, flag;
int *i_ptr3, *i_ptr4, *i_ptr5;
int *e_list = NULL;
int *e_list = nullptr;
int mx0 = I->iMax[0], mx1 = I->iMax[1], a, am1, ap2, *i_ptr1, b, bm1, bp2, *i_ptr2;
unsigned int mapSize;
int ok = true;
Expand Down Expand Up @@ -744,13 +744,13 @@ float MapGetSeparation(PyMOLGlobals * G, float range, const float *mx, const flo

MapType *MapNew(PyMOLGlobals * G, float range, const float *vert, int nVert, const float *extent)
{
return (_MapNew(G, range, vert, nVert, extent, NULL, -1, 0));
return (_MapNew(G, range, vert, nVert, extent, nullptr, -1, 0));
}

MapType *MapNewCached(PyMOLGlobals * G, float range, const float *vert, int nVert,
const float *extent, int group_id, int block_id)
{
return (_MapNew(G, range, vert, nVert, extent, NULL, group_id, block_id));
return (_MapNew(G, range, vert, nVert, extent, nullptr, group_id, block_id));
}

MapType *MapNewFlagged(PyMOLGlobals * G, float range, const float *vert, int nVert,
Expand All @@ -776,7 +776,7 @@ static MapType *_MapNew(PyMOLGlobals * G, float range, const float *vert, int nV
" MapNew-Debug: entered.\n" ENDFD;
CHECKOK(ok, I);
if (!ok){
return NULL;
return nullptr;
}
/* Initialize */
I->G = G;
Expand All @@ -788,7 +788,7 @@ static MapType *_MapNew(PyMOLGlobals * G, float range, const float *vert, int nV
CHECKOK(ok, I->Link);
if (!ok){
MapFree(I);
return NULL;
return nullptr;
}
for(a = 0; a < nVert; a++)
I->Link[a] = -1;
Expand Down Expand Up @@ -932,7 +932,7 @@ static MapType *_MapNew(PyMOLGlobals * G, float range, const float *vert, int nV
CHECKOK(ok, I->Head);
if (!ok){
MapFree(I);
return NULL;
return nullptr;
}
/* initialize */
/* for(a=0;a<I->Dim[0];a++)
Expand Down
4 changes: 2 additions & 2 deletions layer0/Match.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ CMatch *MatchNew(PyMOLGlobals * G, unsigned int na, unsigned int nb, int dist_ma

if(!(I->mat && I->smat && ((!dist_mats) || (I->da && I->db)))) {
MatchFree(I);
I = NULL;
I = nullptr;
}
return (I);
}
Expand Down Expand Up @@ -270,7 +270,7 @@ int MatchMatrixFromFile(CMatch * I, const char *fname, int quiet)
std::string buffer;
const char *p;
char cc[255];
char *code = NULL;
char *code = nullptr;
unsigned int x, y;
int a;
int n_entry;
Expand Down
Loading

0 comments on commit 947e208

Please sign in to comment.