Don't compare pointer against '0', but NULL

This commit is contained in:
Sylvain 2022-11-16 21:47:43 +01:00
parent 1d7966df15
commit ce5da5d579
No known key found for this signature in database
GPG Key ID: 5F87E02E5BC0939E
14 changed files with 21 additions and 21 deletions

View File

@ -127,7 +127,7 @@ initializeTextures(SDL_Renderer *renderer)
/* create ship texture from surface */
ship = SDL_CreateTextureFromSurface(renderer, bmp_surface);
if (ship == 0) {
if (!ship) {
fatalError("could not create ship texture");
}
SDL_SetTextureBlendMode(ship, SDL_BLENDMODE_BLEND);
@ -145,7 +145,7 @@ initializeTextures(SDL_Renderer *renderer)
}
/* create space texture from surface */
space = SDL_CreateTextureFromSurface(renderer, bmp_surface);
if (space == 0) {
if (!space) {
fatalError("could not create space texture");
}
SDL_FreeSurface(bmp_surface);

View File

@ -117,7 +117,7 @@ initializeTexture(SDL_Renderer *renderer)
/* convert RGBA surface to texture */
texture = SDL_CreateTextureFromSurface(renderer, bmp_surface);
if (texture == 0) {
if (!texture) {
fatalError("could not create texture");
}
SDL_SetTextureBlendMode(texture, SDL_BLENDMODE_BLEND);

View File

@ -183,7 +183,7 @@ loadFont(void)
SDL_BlitSurface(surface, NULL, converted, NULL);
/* create our texture */
texture = SDL_CreateTextureFromSurface(renderer, converted);
if (texture == 0) {
if (!texture) {
printf("texture creation failed: %s\n", SDL_GetError());
} else {
/* set blend mode for our texture */

View File

@ -58,7 +58,7 @@ main(int argc, char *argv[])
/* create window and renderer */
window = SDL_CreateWindow(NULL, 0, 0, 320, 480, SDL_WINDOW_ALLOW_HIGHDPI);
if (window == 0) {
if (!window) {
fatalError("Could not initialize Window");
}
renderer = SDL_CreateRenderer(window, -1, 0);

View File

@ -63,7 +63,7 @@ initializeTexture(SDL_Renderer *renderer)
brush =
SDL_CreateTextureFromSurface(renderer, bmp_surface);
SDL_FreeSurface(bmp_surface);
if (brush == 0) {
if (!brush) {
fatalError("could not create brush texture");
}
/* additive blending -- laying strokes on top of eachother makes them brighter */

View File

@ -318,7 +318,7 @@ ARTS_Init(SDL_AudioDriverImpl * impl)
if (LoadARTSLibrary() < 0) {
return SDL_FALSE;
} else {
if (SDL_NAME(arts_init) () != 0) {
if (SDL_NAME(arts_init) () != NULL) {
UnloadARTSLibrary();
SDL_SetError("ARTS: arts_init failed (no audio server?)");
return SDL_FALSE;

View File

@ -546,10 +546,10 @@ PS2_DestroyTexture(SDL_Renderer * renderer, SDL_Texture * texture)
GSTEXTURE *ps2_texture = (GSTEXTURE *) texture->driverdata;
PS2_RenderData *data = (PS2_RenderData *)renderer->driverdata;
if (data == 0)
if (data == NULL)
return;
if(ps2_texture == 0)
if(ps2_texture == NULL)
return;
// Free from vram

View File

@ -1280,10 +1280,10 @@ PSP_DestroyTexture(SDL_Renderer * renderer, SDL_Texture * texture)
PSP_RenderData *renderdata = (PSP_RenderData *) renderer->driverdata;
PSP_TextureData *psp_texture = (PSP_TextureData *) texture->driverdata;
if (renderdata == 0)
if (renderdata == NULL)
return;
if(psp_texture == 0)
if(psp_texture == NULL)
return;
LRUTargetRemove(renderdata, psp_texture);

View File

@ -1236,13 +1236,13 @@ VITA_GXM_DestroyTexture(SDL_Renderer *renderer, SDL_Texture *texture)
VITA_GXM_RenderData *data = (VITA_GXM_RenderData *) renderer->driverdata;
VITA_GXM_TextureData *vita_texture = (VITA_GXM_TextureData *) texture->driverdata;
if (data == 0)
if (data == NULL)
return;
if(vita_texture == 0)
if(vita_texture == NULL)
return;
if(vita_texture->tex == 0)
if(vita_texture->tex == NULL)
return;
sceGxmFinish(data->gxm_context);

View File

@ -414,7 +414,7 @@ static void qsort_nonaligned(void *base, size_t nmemb, size_t size,
char *first,*last;
char *pivot=malloc(size);
size_t trunc=TRUNC_nonaligned*size;
assert(pivot!=0);
assert(pivot);
first=(char*)base; last=first+(nmemb-1)*size;
@ -445,7 +445,7 @@ static void qsort_aligned(void *base, size_t nmemb, size_t size,
char *first,*last;
char *pivot=malloc(size);
size_t trunc=TRUNC_aligned*size;
assert(pivot!=0);
assert(pivot);
first=(char*)base; last=first+(nmemb-1)*size;
@ -475,7 +475,7 @@ static void qsort_words(void *base, size_t nmemb,
int stacktop=0;
char *first,*last;
char *pivot=malloc(WORD_BYTES);
assert(pivot!=0);
assert(pivot);
first=(char*)base; last=first+(nmemb-1)*WORD_BYTES;

View File

@ -296,7 +296,7 @@ static BOOL voUpdate(PVODATA pVOData, HWND hwnd, SDL_Rect *pSDLRects,
return FALSE;
}
if (pSDLRects != 0) {
if (pSDLRects != NULL) {
PBYTE pbLineMask;
pbLineMask = SDL_stack_alloc(BYTE, pVOData->ulHeight);

View File

@ -100,7 +100,7 @@ static void X11_ReadProperty(SDL_x11Prop *p, Display *disp, Window w, Atom prop)
int bytes_fetch = 0;
do {
if (ret != 0) X11_XFree(ret);
if (ret != NULL) X11_XFree(ret);
X11_XGetWindowProperty(disp, w, prop, 0, bytes_fetch, False, AnyPropertyType, &type, &fmt, &count, &bytes_left, &ret);
bytes_fetch += bytes_left;
} while (bytes_left != 0);

View File

@ -1562,7 +1562,7 @@ static void X11_ReadProperty(SDL_x11Prop *p, Display *disp, Window w, Atom prop)
int bytes_fetch = 0;
do {
if (ret != 0) X11_XFree(ret);
if (ret != NULL) X11_XFree(ret);
X11_XGetWindowProperty(disp, w, prop, 0, bytes_fetch, False, AnyPropertyType, &type, &fmt, &count, &bytes_left, &ret);
bytes_fetch += bytes_left;
} while (bytes_left != 0);

View File

@ -53,7 +53,7 @@ void InitCreateRenderer(void *arg)
renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED);
SDLTest_AssertPass("SDL_CreateRenderer()");
SDLTest_AssertCheck(renderer != 0, "Check SDL_CreateRenderer result");
SDLTest_AssertCheck(renderer, "Check SDL_CreateRenderer result");
if (renderer == NULL) {
SDL_DestroyWindow(window);
return;