Don't compare pointer against '0', but NULL
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225
diff --git a/Xcode-iOS/Demos/src/accelerometer.c b/Xcode-iOS/Demos/src/accelerometer.c
index 925aee4..0af1536 100644
--- a/Xcode-iOS/Demos/src/accelerometer.c
+++ b/Xcode-iOS/Demos/src/accelerometer.c
@@ -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);
diff --git a/Xcode-iOS/Demos/src/happy.c b/Xcode-iOS/Demos/src/happy.c
index 658a65f..73d4d4f 100644
--- a/Xcode-iOS/Demos/src/happy.c
+++ b/Xcode-iOS/Demos/src/happy.c
@@ -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);
diff --git a/Xcode-iOS/Demos/src/keyboard.c b/Xcode-iOS/Demos/src/keyboard.c
index cfbe4e6..4d630ba 100644
--- a/Xcode-iOS/Demos/src/keyboard.c
+++ b/Xcode-iOS/Demos/src/keyboard.c
@@ -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 */
diff --git a/Xcode-iOS/Demos/src/rectangles.c b/Xcode-iOS/Demos/src/rectangles.c
index 10f9f85..a08f997 100644
--- a/Xcode-iOS/Demos/src/rectangles.c
+++ b/Xcode-iOS/Demos/src/rectangles.c
@@ -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);
diff --git a/Xcode-iOS/Demos/src/touch.c b/Xcode-iOS/Demos/src/touch.c
index 918240b..6c18463 100644
--- a/Xcode-iOS/Demos/src/touch.c
+++ b/Xcode-iOS/Demos/src/touch.c
@@ -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 */
diff --git a/src/audio/arts/SDL_artsaudio.c b/src/audio/arts/SDL_artsaudio.c
index ce74b7d..82d84e3 100644
--- a/src/audio/arts/SDL_artsaudio.c
+++ b/src/audio/arts/SDL_artsaudio.c
@@ -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;
diff --git a/src/render/ps2/SDL_render_ps2.c b/src/render/ps2/SDL_render_ps2.c
index 54ace06..f385f53 100644
--- a/src/render/ps2/SDL_render_ps2.c
+++ b/src/render/ps2/SDL_render_ps2.c
@@ -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
diff --git a/src/render/psp/SDL_render_psp.c b/src/render/psp/SDL_render_psp.c
index 6644230..9a4e5c7 100644
--- a/src/render/psp/SDL_render_psp.c
+++ b/src/render/psp/SDL_render_psp.c
@@ -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);
diff --git a/src/render/vitagxm/SDL_render_vita_gxm.c b/src/render/vitagxm/SDL_render_vita_gxm.c
index 55ffe0c..1391b19 100644
--- a/src/render/vitagxm/SDL_render_vita_gxm.c
+++ b/src/render/vitagxm/SDL_render_vita_gxm.c
@@ -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);
diff --git a/src/stdlib/SDL_qsort.c b/src/stdlib/SDL_qsort.c
index 26e97c9..b0f92fd 100644
--- a/src/stdlib/SDL_qsort.c
+++ b/src/stdlib/SDL_qsort.c
@@ -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;
diff --git a/src/video/os2/SDL_os2dive.c b/src/video/os2/SDL_os2dive.c
index 95aae6f..56cfde1 100644
--- a/src/video/os2/SDL_os2dive.c
+++ b/src/video/os2/SDL_os2dive.c
@@ -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);
diff --git a/src/video/x11/SDL_x11events.c b/src/video/x11/SDL_x11events.c
index 38e1a79..6b6b834 100644
--- a/src/video/x11/SDL_x11events.c
+++ b/src/video/x11/SDL_x11events.c
@@ -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);
diff --git a/src/video/x11/SDL_x11window.c b/src/video/x11/SDL_x11window.c
index 9b007e7..6d4e53f 100644
--- a/src/video/x11/SDL_x11window.c
+++ b/src/video/x11/SDL_x11window.c
@@ -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);
diff --git a/test/testautomation_render.c b/test/testautomation_render.c
index 0117334..50142f2 100644
--- a/test/testautomation_render.c
+++ b/test/testautomation_render.c
@@ -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;