[PyQt] [PATCH 2/5] Use SIP_NULLPTR for null pointer constants
Stefan Brüns
stefan.bruens at rwth-aachen.de
Sat Sep 29 15:27:46 BST 2018
Current versions of GCC and LLVM issue a warning "zero as null pointer
constant [-Wzero-as-null-pointer-constant]" if 0 is used.
Signed-off-by: Stefan Brüns <stefan.bruens at rwth-aachen.de>
---
sipgen/gencode.c | 204 +++++++++++++++++++++++------------------------
1 file changed, 102 insertions(+), 102 deletions(-)
diff --git a/sipgen/gencode.c b/sipgen/gencode.c
index 58fc35e..b08f255 100644
--- a/sipgen/gencode.c
+++ b/sipgen/gencode.c
@@ -1215,7 +1215,7 @@ static void generateCompositeCpp(sipSpec *pt, const char *codeDir,
"#endif\n"
"\n"
" if (sipModule == NULL)\n"
-" SIP_MODULE_RETURN(NULL);\n"
+" SIP_MODULE_RETURN(SIP_NULLPTR);\n"
"\n"
" sipModuleDict = PyModule_GetDict(sipModule);\n"
"\n"
@@ -1355,8 +1355,8 @@ static void generateConsolidatedCpp(sipSpec *pt, const char *codeDir,
prcode(fp,
" static PyMethodDef sip_methods[] = {\n"
-" {SIP_MLNAME_CAST(\"init\"), sip_init, METH_O, NULL},\n"
-" {NULL, NULL, 0, NULL}\n"
+" {SIP_MLNAME_CAST(\"init\"), sip_init, METH_O, SIP_NULLPTR},\n"
+" {SIP_NULLPTR, SIP_NULLPTR, 0, SIP_NULLPTR}\n"
" };\n"
);
@@ -1439,7 +1439,7 @@ static void generateComponentCpp(sipSpec *pt, const char *codeDir,
"\n"
" /* Import the consolidated module. */\n"
" if ((sip_mod = PyImport_ImportModule(\"%s\")) == NULL)\n"
-" SIP_MODULE_RETURN(NULL);\n"
+" SIP_MODULE_RETURN(SIP_NULLPTR);\n"
"\n"
, consModule);
@@ -1928,7 +1928,7 @@ static void generateCpp(sipSpec *pt, moduleDef *mod, const char *codeDir,
if (ed->slots != NULL)
prcode(fp, "slots_%C", ed->fqcname);
else
- prcode(fp, "NULL");
+ prcode(fp, "SIP_NULLPTR");
prcode(fp, "},\n"
);
@@ -2509,7 +2509,7 @@ static void generateCpp(sipSpec *pt, moduleDef *mod, const char *codeDir,
generateGlobalFunctionTableEntries(pt, mod, cd->members, fp);
prcode(fp,
-" {0, 0, 0, 0}\n"
+" {SIP_NULLPTR, SIP_NULLPTR, 0, SIP_NULLPTR}\n"
" };\n"
);
@@ -2572,7 +2572,7 @@ static void generateCpp(sipSpec *pt, moduleDef *mod, const char *codeDir,
"#endif\n"
"\n"
" if (sipModule == NULL)\n"
-" SIP_MODULE_RETURN(NULL);\n"
+" SIP_MODULE_RETURN(SIP_NULLPTR);\n"
"\n"
" sipModuleDict = PyModule_GetDict(sipModule);\n"
"\n"
@@ -2588,7 +2588,7 @@ static void generateCpp(sipSpec *pt, moduleDef *mod, const char *codeDir,
" if (sipExportModule(&sipModuleAPI_%s,SIP_API_MAJOR_NR,SIP_API_MINOR_NR,0) < 0)\n"
" {\n"
" SIP_MODULE_DISCARD(sipModule);\n"
-" SIP_MODULE_RETURN(0);\n"
+" SIP_MODULE_RETURN(SIP_NULLPTR);\n"
" }\n"
, mname);
@@ -2615,7 +2615,7 @@ static void generateCpp(sipSpec *pt, moduleDef *mod, const char *codeDir,
" if (sipInitModule(&sipModuleAPI_%s,sipModuleDict) < 0)\n"
" {\n"
" SIP_MODULE_DISCARD(sipModule);\n"
-" SIP_MODULE_RETURN(0);\n"
+" SIP_MODULE_RETURN(SIP_NULLPTR);\n"
" }\n"
, mname);
@@ -2653,7 +2653,7 @@ static void generateCpp(sipSpec *pt, moduleDef *mod, const char *codeDir,
prcode(fp, ",NULL)) == NULL || PyDict_SetItemString(sipModuleDict, \"%s\", sipExportedExceptions_%s[%d]) < 0)\n"
" {\n"
" SIP_MODULE_DISCARD(sipModule);\n"
-" SIP_MODULE_RETURN(0);\n"
+" SIP_MODULE_RETURN(SIP_NULLPTR);\n"
" }\n"
, xd->pyname, xd->iff->module->name, xd->exceptionnr);
}
@@ -2814,7 +2814,7 @@ static void generateSipImport(moduleDef *mod, const char *sipName, FILE *fp)
" if (sip_sipmod == NULL)\n"
" {\n"
" SIP_MODULE_DISCARD(sipModule);\n"
-" SIP_MODULE_RETURN(NULL);\n"
+" SIP_MODULE_RETURN(SIP_NULLPTR);\n"
" }\n"
"\n"
" sip_capiobj = PyDict_GetItemString(PyModule_GetDict(sip_sipmod), \"_C_API\");\n"
@@ -2827,7 +2827,7 @@ static void generateSipImport(moduleDef *mod, const char *sipName, FILE *fp)
"#endif\n"
" {\n"
" SIP_MODULE_DISCARD(sipModule);\n"
-" SIP_MODULE_RETURN(NULL);\n"
+" SIP_MODULE_RETURN(SIP_NULLPTR);\n"
" }\n"
"\n"
);
@@ -2857,7 +2857,7 @@ static void generateSipImport(moduleDef *mod, const char *sipName, FILE *fp)
" if (sipAPI_%s == NULL)\n"
" {\n"
" SIP_MODULE_DISCARD(sipModule);\n"
-" SIP_MODULE_RETURN(NULL);\n"
+" SIP_MODULE_RETURN(SIP_NULLPTR);\n"
" }\n"
"#endif\n"
"\n"
@@ -3188,12 +3188,12 @@ static void generateOrdinaryFunction(sipSpec *pt, moduleDef *mod,
}
else
{
- prcode(fp, "NULL");
+ prcode(fp, "SIP_NULLPTR");
}
prcode(fp, ");\n"
"\n"
-" return NULL;\n"
+" return SIP_NULLPTR;\n"
);
}
@@ -4515,7 +4515,7 @@ static void generateTypeDefLink(ifaceFileDef *iff, FILE *fp)
prcode(fp, ".ctd_base");
}
else
- prcode(fp, "0");
+ prcode(fp, "SIP_NULLPTR");
}
@@ -4808,7 +4808,7 @@ static void prMethodTable(sipSpec *pt, sortedMethTab *mtable, int nr,
if (hasMemberDocstring(pt, overs, md, iff))
prcode(fp, "SIP_MLDOC_CAST(doc_%L_%s)", iff, md->pyname->text);
else
- prcode(fp, "NULL");
+ prcode(fp, "SIP_NULLPTR");
prcode(fp, "}%s\n"
, ((i + 1) < nr) ? "," : "");
@@ -5509,7 +5509,7 @@ static void generateVariableSetter(ifaceFileDef *scope, varDef *vd, FILE *fp)
{
prcode(fp,
"\n"
-" static PyObject *sipKeep = 0;\n"
+" static PyObject *sipKeep = SIP_NULLPTR;\n"
"\n"
" Py_XDECREF(sipKeep);\n"
" sipKeep = sipPy;\n"
@@ -6096,7 +6096,7 @@ static void generateSlot(moduleDef *mod, classDef *cd, enumDef *ed,
if (has_args)
prcode(fp,
-" PyObject *sipParseErr = NULL;\n"
+" PyObject *sipParseErr = SIP_NULLPTR;\n"
);
for (od = overs; od != NULL; od = od->next)
@@ -6145,7 +6145,7 @@ static void generateSlot(moduleDef *mod, classDef *cd, enumDef *ed,
" Py_XDECREF(sipParseErr);\n"
"\n"
" if (sipParseErr == Py_None)\n"
-" return NULL;\n"
+" return SIP_NULLPTR;\n"
);
}
@@ -6161,7 +6161,7 @@ static void generateSlot(moduleDef *mod, classDef *cd, enumDef *ed,
else if (isNumberSlot(md))
prcode(fp,
"\n"
-" return sipPySlotExtend(&sipModuleAPI_%s, %s, NULL, sipArg0, sipArg1);\n"
+" return sipPySlotExtend(&sipModuleAPI_%s, %s, SIP_NULLPTR, sipArg0, sipArg1);\n"
, mod->name, slotName(md->slot));
else
prcode(fp,
@@ -7060,7 +7060,7 @@ static void generateShadowCode(sipSpec *pt, moduleDef *mod, classDef *cd,
generateProtectedCallArgs(mod, ct->cppsig, fp);
- prcode(fp,"), sipPySelf(0)\n"
+ prcode(fp,"), sipPySelf(SIP_NULLPTR)\n"
"{\n"
);
@@ -7317,7 +7317,7 @@ static void generateVirtualCatcher(moduleDef *mod, classDef *cd, int virtNr,
if (isAbstract(od))
prcode(fp, "%N", cd->pyname);
else
- prcode(fp,"NULL");
+ prcode(fp,"SIP_NULLPTR");
prcode(fp,",%N);\n"
"\n"
@@ -7666,7 +7666,7 @@ static void generateDefaultInstanceReturn(argDef *res, const char *indent,
prcode(fp,
"%s{\n"
-"%s static %B *sipCpp = 0;\n"
+"%s static %B *sipCpp = SIP_NULLPTR;\n"
"\n"
"%s if (!sipCpp)\n"
"%s {\n"
@@ -8154,7 +8154,7 @@ static void generateVirtualHandler(moduleDef *mod, virtHandlerDef *vhd,
" {\n"
" // Return any previous result to the heap.\n"
" sipFree(%s);\n"
-" sipRes = 0;\n"
+" sipRes = SIP_NULLPTR;\n"
" }\n"
"\n"
, (isConstArg(res) ? "const_cast<wchar_t *>(sipRes)" : "sipRes"));
@@ -8223,7 +8223,7 @@ static void generateVirtualHandler(moduleDef *mod, virtHandlerDef *vhd,
" sipCallProcedureMethod(sipGILState, sipErrorHandler, sipPySelf, sipMethod, ");
else
prcode(fp,
-" PyObject *sipResObj = sipCallMethod(0, sipMethod, ");
+" PyObject *sipResObj = sipCallMethod(SIP_NULLPTR, sipMethod, ");
saved = *vhd->pysig;
fakeProtectedArgs(vhd->pysig);
@@ -10059,15 +10059,15 @@ static void generateTypeDefinition(sipSpec *pt, classDef *cd, int py_debug,
if (pd->set != NULL)
prcode(fp, "&methods_%L[%d], ", cd->iff, findMethod(cd, pd->set)->membernr);
else
- prcode(fp, "NULL, ");
+ prcode(fp, "SIP_NULLPTR, ");
/* We don't support a deleter yet. */
- prcode(fp, "NULL, ");
+ prcode(fp, "SIP_NULLPTR, ");
if (pd->docstring != NULL)
prcode(fp, "doc_%L_%s", cd->iff, pd->name->text);
else
- prcode(fp, "NULL");
+ prcode(fp, "SIP_NULLPTR");
prcode(fp, "},\n"
);
@@ -10086,9 +10086,9 @@ static void generateTypeDefinition(sipSpec *pt, classDef *cd, int py_debug,
if (canSetVariable(vd))
prcode(fp, "(PyMethodDef *)varset_%C", vd->fqcname);
else
- prcode(fp, "NULL");
+ prcode(fp, "SIP_NULLPTR");
- prcode(fp, ", NULL, NULL},\n"
+ prcode(fp, ", 0, SIP_NULLPTR},\n"
);
}
}
@@ -10153,7 +10153,7 @@ static void generateTypeDefinition(sipSpec *pt, classDef *cd, int py_debug,
generateTypeDefLink(cd->iff, fp);
prcode(fp, ",\n"
-" 0,\n"
+" SIP_NULLPTR,\n"
" ");
sep = "";
@@ -10212,7 +10212,7 @@ static void generateTypeDefinition(sipSpec *pt, classDef *cd, int py_debug,
prcode(fp,
" %n,\n"
-" {0},\n"
+" {SIP_NULLPTR},\n"
, cd->iff->name);
if (plugin)
@@ -10221,7 +10221,7 @@ static void generateTypeDefinition(sipSpec *pt, classDef *cd, int py_debug,
, cd->iff);
else
prcode(fp,
-" 0\n"
+" SIP_NULLPTR\n"
);
prcode(fp,
@@ -10252,7 +10252,7 @@ static void generateTypeDefinition(sipSpec *pt, classDef *cd, int py_debug,
if (nr_methods == 0)
prcode(fp,
-" 0, 0,\n"
+" 0, SIP_NULLPTR,\n"
);
else
prcode(fp,
@@ -10261,7 +10261,7 @@ static void generateTypeDefinition(sipSpec *pt, classDef *cd, int py_debug,
if (nr_enums == 0)
prcode(fp,
-" 0, 0,\n"
+" 0, SIP_NULLPTR,\n"
);
else
prcode(fp,
@@ -10270,7 +10270,7 @@ static void generateTypeDefinition(sipSpec *pt, classDef *cd, int py_debug,
if (nr_vars == 0)
prcode(fp,
-" 0, 0,\n"
+" 0, SIP_NULLPTR,\n"
);
else
prcode(fp,
@@ -10283,52 +10283,52 @@ static void generateTypeDefinition(sipSpec *pt, classDef *cd, int py_debug,
if (is_inst_class)
prcode(fp, "typeInstances_%C, ", classFQCName(cd));
else
- prcode(fp, "0, ");
+ prcode(fp, "SIP_NULLPTR, ");
if (is_inst_voidp)
prcode(fp, "voidPtrInstances_%C, ", classFQCName(cd));
else
- prcode(fp, "0, ");
+ prcode(fp, "SIP_NULLPTR, ");
if (is_inst_char)
prcode(fp, "charInstances_%C, ", classFQCName(cd));
else
- prcode(fp, "0, ");
+ prcode(fp, "SIP_NULLPTR, ");
if (is_inst_string)
prcode(fp, "stringInstances_%C, ", classFQCName(cd));
else
- prcode(fp, "0, ");
+ prcode(fp, "SIP_NULLPTR, ");
if (is_inst_int)
prcode(fp, "intInstances_%C, ", classFQCName(cd));
else
- prcode(fp, "0, ");
+ prcode(fp, "SIP_NULLPTR, ");
if (is_inst_long)
prcode(fp, "longInstances_%C, ", classFQCName(cd));
else
- prcode(fp, "0, ");
+ prcode(fp, "SIP_NULLPTR, ");
if (is_inst_ulong)
prcode(fp, "unsignedLongInstances_%C, ", classFQCName(cd));
else
- prcode(fp, "0, ");
+ prcode(fp, "SIP_NULLPTR, ");
if (is_inst_longlong)
prcode(fp, "longLongInstances_%C, ", classFQCName(cd));
else
- prcode(fp,"0, ");
+ prcode(fp,"SIP_NULLPTR, ");
if (is_inst_ulonglong)
prcode(fp, "unsignedLongLongInstances_%C, ", classFQCName(cd));
else
- prcode(fp, "0, ");
+ prcode(fp, "SIP_NULLPTR, ");
if (is_inst_double)
prcode(fp, "doubleInstances_%C", classFQCName(cd));
else
- prcode(fp, "0");
+ prcode(fp, "SIP_NULLPTR");
prcode(fp,"},\n"
" },\n"
@@ -10340,7 +10340,7 @@ static void generateTypeDefinition(sipSpec *pt, classDef *cd, int py_debug,
, cd->iff);
else
prcode(fp,
-" 0,\n"
+" SIP_NULLPTR,\n"
);
if (cd->metatype != NULL)
@@ -10367,7 +10367,7 @@ static void generateTypeDefinition(sipSpec *pt, classDef *cd, int py_debug,
, classFQCName(cd));
else
prcode(fp,
-" 0,\n"
+" SIP_NULLPTR,\n"
);
if (is_slots)
@@ -10376,7 +10376,7 @@ static void generateTypeDefinition(sipSpec *pt, classDef *cd, int py_debug,
, cd->iff);
else
prcode(fp,
-" 0,\n"
+" SIP_NULLPTR,\n"
);
if (canCreate(cd))
@@ -10385,7 +10385,7 @@ static void generateTypeDefinition(sipSpec *pt, classDef *cd, int py_debug,
, cd->iff);
else
prcode(fp,
-" 0,\n"
+" SIP_NULLPTR,\n"
);
if (cd->travcode != NULL)
@@ -10394,7 +10394,7 @@ static void generateTypeDefinition(sipSpec *pt, classDef *cd, int py_debug,
, classFQCName(cd));
else
prcode(fp,
-" 0,\n"
+" SIP_NULLPTR,\n"
);
if (cd->clearcode != NULL)
@@ -10403,7 +10403,7 @@ static void generateTypeDefinition(sipSpec *pt, classDef *cd, int py_debug,
, classFQCName(cd));
else
prcode(fp,
-" 0,\n"
+" SIP_NULLPTR,\n"
);
prcode(fp,
@@ -10416,7 +10416,7 @@ static void generateTypeDefinition(sipSpec *pt, classDef *cd, int py_debug,
, classFQCName(cd));
else
prcode(fp,
-" 0,\n"
+" SIP_NULLPTR,\n"
);
if (cd->releasebufcode != NULL)
@@ -10425,7 +10425,7 @@ static void generateTypeDefinition(sipSpec *pt, classDef *cd, int py_debug,
, classFQCName(cd));
else
prcode(fp,
-" 0,\n"
+" SIP_NULLPTR,\n"
);
prcode(fp,
@@ -10438,7 +10438,7 @@ static void generateTypeDefinition(sipSpec *pt, classDef *cd, int py_debug,
, classFQCName(cd));
else
prcode(fp,
-" 0,\n"
+" SIP_NULLPTR,\n"
);
if (cd->writebufcode != NULL)
@@ -10447,7 +10447,7 @@ static void generateTypeDefinition(sipSpec *pt, classDef *cd, int py_debug,
, classFQCName(cd));
else
prcode(fp,
-" 0,\n"
+" SIP_NULLPTR,\n"
);
if (cd->segcountcode != NULL)
@@ -10456,7 +10456,7 @@ static void generateTypeDefinition(sipSpec *pt, classDef *cd, int py_debug,
, classFQCName(cd));
else
prcode(fp,
-" 0,\n"
+" SIP_NULLPTR,\n"
);
if (cd->charbufcode != NULL)
@@ -10465,7 +10465,7 @@ static void generateTypeDefinition(sipSpec *pt, classDef *cd, int py_debug,
, classFQCName(cd));
else
prcode(fp,
-" 0,\n"
+" SIP_NULLPTR,\n"
);
prcode(fp,
@@ -10478,7 +10478,7 @@ static void generateTypeDefinition(sipSpec *pt, classDef *cd, int py_debug,
, cd->iff);
else
prcode(fp,
-" 0,\n"
+" SIP_NULLPTR,\n"
);
if (generating_c || assignmentHelper(cd))
@@ -10491,14 +10491,14 @@ static void generateTypeDefinition(sipSpec *pt, classDef *cd, int py_debug,
, cd->iff);
else
prcode(fp,
-" 0,\n"
-" 0,\n"
-" 0,\n"
+" SIP_NULLPTR,\n"
+" SIP_NULLPTR,\n"
+" SIP_NULLPTR,\n"
);
if (cd->iff->type == namespace_iface || generating_c)
prcode(fp,
-" 0,\n"
+" SIP_NULLPTR,\n"
);
else
prcode(fp,
@@ -10511,13 +10511,13 @@ static void generateTypeDefinition(sipSpec *pt, classDef *cd, int py_debug,
, cd->iff);
else
prcode(fp,
-" 0,\n"
+" SIP_NULLPTR,\n"
);
if (cd->iff->type == namespace_iface)
{
prcode(fp,
-" 0,\n"
+" SIP_NULLPTR,\n"
);
}
else
@@ -10528,14 +10528,14 @@ static void generateTypeDefinition(sipSpec *pt, classDef *cd, int py_debug,
, cd->iff);
else
prcode(fp,
-" 0,\n"
+" SIP_NULLPTR,\n"
);
}
if (cd->iff->type == namespace_iface)
{
prcode(fp,
-" 0,\n"
+" SIP_NULLPTR,\n"
);
}
else
@@ -10546,12 +10546,12 @@ static void generateTypeDefinition(sipSpec *pt, classDef *cd, int py_debug,
, cd->iff);
else
prcode(fp,
-" 0,\n"
+" SIP_NULLPTR,\n"
);
}
prcode(fp,
-" 0,\n"
+" SIP_NULLPTR,\n"
);
if (cd->picklecode != NULL)
@@ -10560,7 +10560,7 @@ static void generateTypeDefinition(sipSpec *pt, classDef *cd, int py_debug,
, classFQCName(cd));
else
prcode(fp,
-" 0,\n"
+" SIP_NULLPTR,\n"
);
if (cd->finalcode != NULL)
@@ -10569,7 +10569,7 @@ static void generateTypeDefinition(sipSpec *pt, classDef *cd, int py_debug,
, classFQCName(cd));
else
prcode(fp,
-" 0,\n"
+" SIP_NULLPTR,\n"
);
if (isMixin(cd))
@@ -10578,7 +10578,7 @@ static void generateTypeDefinition(sipSpec *pt, classDef *cd, int py_debug,
, classFQCName(cd));
else
prcode(fp,
-" 0\n"
+" SIP_NULLPTR\n"
);
prcode(fp,
@@ -10632,7 +10632,7 @@ static void generatePyQt5Emitters(classDef *cd, FILE *fp)
prcode(fp,
"static int emit_%L_%s(void *sipCppV, PyObject *sipArgs)\n"
"{\n"
-" PyObject *sipParseErr = NULL;\n"
+" PyObject *sipParseErr = SIP_NULLPTR;\n"
" %V *sipCpp = reinterpret_cast<%V *>(sipCppV);\n"
, cd->iff, od->cppname
, classFQCName(cd), classFQCName(cd));
@@ -10676,7 +10676,7 @@ static void generatePyQt5Emitters(classDef *cd, FILE *fp)
{
prcode(fp,
"\n"
-" sipNoMethod(sipParseErr, %N, %N, NULL);\n"
+" sipNoMethod(sipParseErr, %N, %N, SIP_NULLPTR);\n"
"\n"
" return -1;\n"
"}\n"
@@ -10777,20 +10777,20 @@ static void generateSignalTableEntry(sipSpec *pt, classDef *cd, overDef *sig,
}
else
{
- prcode(fp, "0, ");
+ prcode(fp, "SIP_NULLPTR, ");
}
if (membernr >= 0)
prcode(fp, "&methods_%L[%d], ", cd->iff, membernr);
else
- prcode(fp, "0, ");
+ prcode(fp, "SIP_NULLPTR, ");
if (pyqt5)
{
if (optional_args)
prcode(fp, "emit_%L_%s", cd->iff, sig->cppname);
else
- prcode(fp, "0");
+ prcode(fp, "SIP_NULLPTR");
}
else
{
@@ -11157,11 +11157,11 @@ static void generateTypeInit(classDef *cd, moduleDef *mod, FILE *fp)
if (hasShadow(cd))
prcode(fp,
-" sip%C *sipCpp = 0;\n"
+" sip%C *sipCpp = SIP_NULLPTR;\n"
,classFQCName(cd));
else
prcode(fp,
-" %U *sipCpp = 0;\n"
+" %U *sipCpp = SIP_NULLPTR;\n"
,cd);
if (tracing)
@@ -11239,7 +11239,7 @@ static void generateTypeInit(classDef *cd, moduleDef *mod, FILE *fp)
prcode(fp,
"\n"
-" return NULL;\n"
+" return SIP_NULLPTR;\n"
"}\n"
);
}
@@ -11324,7 +11324,7 @@ static void generateCatch(throwArgs *ta, signatureDef *sd, moduleDef *mod,
prcode(fp,
" sipRaiseUnknownException();\n"
-" return NULL;\n"
+" return SIP_NULLPTR;\n"
" }\n"
);
}
@@ -11367,7 +11367,7 @@ static void generateCatchBlock(moduleDef *mod, exceptionDef *xd,
prcode(fp,
"\n"
-" return NULL;\n"
+" return SIP_NULLPTR;\n"
" }\n"
);
}
@@ -11537,7 +11537,7 @@ static void generateConstructorCall(classDef *cd, ctorDef *ct, int error_flag,
" if (PyErr_Occurred())\n"
" {\n"
" delete sipCpp;\n"
-" return NULL;\n"
+" return SIP_NULLPTR;\n"
" }\n"
"\n"
);
@@ -11586,7 +11586,7 @@ static void generateConstructorCall(classDef *cd, ctorDef *ct, int error_flag,
" sipAddException(sipError, sipParseErr);\n"
"\n"
" if (sipError == sipErrorFail)\n"
-" return NULL;\n"
+" return SIP_NULLPTR;\n"
);
}
else
@@ -11602,7 +11602,7 @@ static void generateConstructorCall(classDef *cd, ctorDef *ct, int error_flag,
" }\n"
"\n"
" sipAddException(sipErrorFail, sipParseErr);\n"
-" return NULL;\n"
+" return SIP_NULLPTR;\n"
" }\n"
"\n"
);
@@ -11753,7 +11753,7 @@ static void generateFunction(sipSpec *pt, memberDef *md, overDef *overs,
{
if (need_args)
prcode(fp,
-" PyObject *sipParseErr = NULL;\n"
+" PyObject *sipParseErr = SIP_NULLPTR;\n"
);
if (need_selfarg)
@@ -11818,16 +11818,16 @@ static void generateFunction(sipSpec *pt, memberDef *md, overDef *overs,
prcode(fp,
"\n"
" /* Raise an exception if the arguments couldn't be parsed. */\n"
-" sipNoMethod(%s, %N, %N, ", (need_args ? "sipParseErr" : "NULL"), cd->pyname, md->pyname);
+" sipNoMethod(%s, %N, %N, ", (need_args ? "sipParseErr" : "SIP_NULLPTR"), cd->pyname, md->pyname);
if (has_auto_docstring)
prcode(fp, "doc_%L_%s", cd->iff, pname);
else
- prcode(fp, "NULL");
+ prcode(fp, "SIP_NULLPTR");
prcode(fp, ");\n"
"\n"
-" return NULL;\n"
+" return SIP_NULLPTR;\n"
);
}
@@ -12027,7 +12027,7 @@ static void generateHandleResult(moduleDef *mod, overDef *od, int isNew,
prcode(fp,"sipRes");
prcode(fp, ",sipType_%C,%s);\n"
- , iff->fqcname, (need_xfer ? "NULL" : resultOwner(od)));
+ , iff->fqcname, (need_xfer ? "SIP_NULLPTR" : resultOwner(od)));
/*
* Transferring the result of a static overload needs an
@@ -12156,7 +12156,7 @@ static void generateHandleResult(moduleDef *mod, overDef *od, int isNew,
prcode(fp, ",sipType_%C,", iff->fqcname);
if (needNew || !isTransferredBack(ad))
- prcode(fp, "NULL);\n");
+ prcode(fp, "SIP_NULLPTR);\n");
else
prcode(fp, "Py_None);\n");
}
@@ -12439,7 +12439,7 @@ static const char *resultOwner(overDef *od)
if (isResultTransferred(od))
return "sipSelf";
- return "NULL";
+ return "SIP_NULLPTR";
}
@@ -13447,7 +13447,7 @@ static int generateArgParser(moduleDef *mod, signatureDef *sd,
if (od != NULL && need_owner)
prcode(fp,
-" sipWrapper *sipOwner = 0;\n"
+" sipWrapper *sipOwner = SIP_NULLPTR;\n"
);
if (handle_self)
@@ -13555,7 +13555,7 @@ static int generateArgParser(moduleDef *mod, signatureDef *sd,
}
prcode(fp,
-" if (sipParseKwdArgs(%ssipParseErr, sipArgs, sipKwds, %s, %s, \"", (ct != NULL ? "" : "&"), (is_ka_list ? "sipKwdList" : "NULL"), (ct != NULL ? "sipUnused" : "NULL"));
+" if (sipParseKwdArgs(%ssipParseErr, sipArgs, sipKwds, %s, %s, \"", (ct != NULL ? "" : "&"), (is_ka_list ? "sipKwdList" : "SIP_NULLPTR"), (ct != NULL ? "sipUnused" : "SIP_NULLPTR"));
}
else
{
@@ -15581,7 +15581,7 @@ static int generatePluginSignalsTable(sipSpec *pt, classDef *cd,
if (is_signals)
prcode(fp,
-" {0, 0, 0, 0}\n"
+" {SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR}\n"
"};\n"
);
}
@@ -15610,7 +15610,7 @@ static int generatePyQt5ClassPlugin(sipSpec *pt, classDef *cd, FILE *fp)
, cd);
else
prcode(fp,
-" 0,\n"
+" SIP_NULLPTR,\n"
);
prcode(fp,
@@ -15623,7 +15623,7 @@ static int generatePyQt5ClassPlugin(sipSpec *pt, classDef *cd, FILE *fp)
, classFQCName(cd));
else
prcode(fp,
-" 0,\n"
+" SIP_NULLPTR,\n"
);
if (cd->pyqt_interface != NULL)
@@ -15632,7 +15632,7 @@ static int generatePyQt5ClassPlugin(sipSpec *pt, classDef *cd, FILE *fp)
, cd->pyqt_interface);
else
prcode(fp,
-" 0\n"
+" SIP_NULLPTR\n"
);
prcode(fp,
@@ -15663,7 +15663,7 @@ static int generatePyQt4ClassPlugin(sipSpec *pt, classDef *cd, FILE *fp)
, cd);
else
prcode(fp,
-" 0,\n"
+" SIP_NULLPTR,\n"
);
prcode(fp,
@@ -15676,7 +15676,7 @@ static int generatePyQt4ClassPlugin(sipSpec *pt, classDef *cd, FILE *fp)
, classFQCName(cd));
else
prcode(fp,
-" 0\n"
+" SIP_NULLPTR\n"
);
prcode(fp,
@@ -15711,7 +15711,7 @@ static void generateGlobalFunctionTableEntries(sipSpec *pt, moduleDef *mod,
prcode(fp, ", SIP_MLDOC_CAST(doc_%s)},\n"
, md->pyname->text);
else
- prcode(fp, ", NULL},\n"
+ prcode(fp, ", SIP_NULLPTR},\n"
);
}
}
--
2.19.0
More information about the PyQt
mailing list