Skip to content

Commit fb33bff

Browse files
committed
Merge commit 'f929ab0569ff31ed5a59b0b0adb7ce09df3fca39'
* commit 'f929ab0569ff31ed5a59b0b0adb7ce09df3fca39': cosmetics: Write NULL pointer equality checks more compactly Conflicts: cmdutils.c ffmpeg_opt.c ffplay.c libavcodec/dvbsub.c libavcodec/dvdsubdec.c libavcodec/dvdsubenc.c libavcodec/dxa.c libavcodec/libxvid_rc.c libavcodec/mpegvideo.c libavcodec/mpegvideo_enc.c libavcodec/rv10.c libavcodec/tiffenc.c libavcodec/utils.c libavcodec/vc1dec.c libavcodec/zmbv.c libavdevice/v4l2.c libavformat/matroskadec.c libavformat/movenc.c libavformat/sdp.c Merged-by: Michael Niedermayer <[email protected]>
2 parents 3bb2297 + f929ab0 commit fb33bff

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+124
-126
lines changed

cmdutils.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ static void prepare_app_arguments(int *argc_ptr, char ***argv_ptr)
254254

255255
win32_argv_utf8 = av_mallocz(sizeof(char *) * (win32_argc + 1) + buffsize);
256256
argstr_flat = (char *)win32_argv_utf8 + sizeof(char *) * (win32_argc + 1);
257-
if (win32_argv_utf8 == NULL) {
257+
if (!win32_argv_utf8) {
258258
LocalFree(argv_w);
259259
return;
260260
}
@@ -1242,7 +1242,7 @@ static int show_formats_devices(void *optctx, const char *opt, const char *arg,
12421242
is_dev = is_device(ofmt->priv_class);
12431243
if (!is_dev && device_only)
12441244
continue;
1245-
if ((name == NULL || strcmp(ofmt->name, name) < 0) &&
1245+
if ((!name || strcmp(ofmt->name, name) < 0) &&
12461246
strcmp(ofmt->name, last_name) > 0) {
12471247
name = ofmt->name;
12481248
long_name = ofmt->long_name;
@@ -1253,7 +1253,7 @@ static int show_formats_devices(void *optctx, const char *opt, const char *arg,
12531253
is_dev = is_device(ifmt->priv_class);
12541254
if (!is_dev && device_only)
12551255
continue;
1256-
if ((name == NULL || strcmp(ifmt->name, name) < 0) &&
1256+
if ((!name || strcmp(ifmt->name, name) < 0) &&
12571257
strcmp(ifmt->name, last_name) > 0) {
12581258
name = ifmt->name;
12591259
long_name = ifmt->long_name;
@@ -1262,7 +1262,7 @@ static int show_formats_devices(void *optctx, const char *opt, const char *arg,
12621262
if (name && strcmp(ifmt->name, name) == 0)
12631263
decode = 1;
12641264
}
1265-
if (name == NULL)
1265+
if (!name)
12661266
break;
12671267
last_name = name;
12681268

compat/avisynth/avisynth_c.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -805,7 +805,7 @@ struct AVS_Library {
805805

806806
AVSC_INLINE AVS_Library * avs_load_library() {
807807
AVS_Library *library = (AVS_Library *)malloc(sizeof(AVS_Library));
808-
if (library == NULL)
808+
if (!library)
809809
return NULL;
810810
library->handle = LoadLibrary("avisynth");
811811
if (library->handle == NULL)
@@ -870,7 +870,7 @@ AVSC_INLINE AVS_Library * avs_load_library() {
870870
}
871871

872872
AVSC_INLINE void avs_free_library(AVS_Library *library) {
873-
if (library == NULL)
873+
if (!library)
874874
return;
875875
FreeLibrary(library->handle);
876876
free(library);

compat/getopt.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ static int getopt(int argc, char *argv[], char *opts)
5454
}
5555
}
5656
optopt = c = argv[optind][sp];
57-
if (c == ':' || (cp = strchr(opts, c)) == NULL) {
57+
if (c == ':' || !(cp = strchr(opts, c))) {
5858
fprintf(stderr, ": illegal option -- %c\n", c);
5959
if (argv[optind][++sp] == '\0') {
6060
optind++;

ffmpeg.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2083,7 +2083,7 @@ static int process_input_packet(InputStream *ist, const AVPacket *pkt)
20832083
if (ist->next_pts == AV_NOPTS_VALUE)
20842084
ist->next_pts = ist->pts;
20852085

2086-
if (pkt == NULL) {
2086+
if (!pkt) {
20872087
/* EOF handling */
20882088
av_init_packet(&avpkt);
20892089
avpkt.data = NULL;

ffplay.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1652,7 +1652,7 @@ static int queue_picture(VideoState *is, AVFrame *src_frame, double pts, double
16521652
is->img_convert_ctx = sws_getCachedContext(is->img_convert_ctx,
16531653
vp->width, vp->height, src_frame->format, vp->width, vp->height,
16541654
AV_PIX_FMT_YUV420P, sws_flags, NULL, NULL, NULL);
1655-
if (is->img_convert_ctx == NULL) {
1655+
if (!is->img_convert_ctx) {
16561656
av_log(NULL, AV_LOG_FATAL, "Cannot initialize the conversion context\n");
16571657
exit(1);
16581658
}

ffserver.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1600,7 +1600,7 @@ static int http_parse_request(HTTPContext *c)
16001600
break;
16011601
stream = stream->next;
16021602
}
1603-
if (stream == NULL) {
1603+
if (!stream) {
16041604
snprintf(msg, sizeof(msg), "File '%s' not found", url);
16051605
http_log("File '%s' not found\n", url);
16061606
goto send_error;
@@ -2980,7 +2980,7 @@ static int prepare_sdp_description(FFStream *stream, uint8_t **pbuffer,
29802980
*pbuffer = NULL;
29812981

29822982
avc = avformat_alloc_context();
2983-
if (avc == NULL || !rtp_format) {
2983+
if (!avc || !rtp_format) {
29842984
return -1;
29852985
}
29862986
avc->oformat = rtp_format;

libavcodec/atrac3.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -888,7 +888,7 @@ static av_cold int atrac3_decode_init(AVCodecContext *avctx)
888888

889889
q->decoded_bytes_buffer = av_mallocz(FFALIGN(avctx->block_align, 4) +
890890
FF_INPUT_BUFFER_PADDING_SIZE);
891-
if (q->decoded_bytes_buffer == NULL)
891+
if (!q->decoded_bytes_buffer)
892892
return AVERROR(ENOMEM);
893893

894894
avctx->sample_fmt = AV_SAMPLE_FMT_FLTP;

libavcodec/cook.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1239,7 +1239,7 @@ static av_cold int cook_decode_init(AVCodecContext *avctx)
12391239
av_mallocz(avctx->block_align
12401240
+ DECODE_BYTES_PAD1(avctx->block_align)
12411241
+ FF_INPUT_BUFFER_PADDING_SIZE);
1242-
if (q->decoded_bytes_buffer == NULL)
1242+
if (!q->decoded_bytes_buffer)
12431243
return AVERROR(ENOMEM);
12441244

12451245
/* Initialize transform. */

libavcodec/dvbsub.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ static int encode_dvb_subtitles(DVBSubtitleContext *s,
258258

259259
page_id = 1;
260260

261-
if (h->num_rects && h->rects == NULL)
261+
if (h->num_rects && !h->rects)
262262
return -1;
263263

264264
/* page composition segment */

libavcodec/dvdsubdec.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ static void reset_rects(AVSubtitle *sub_header)
195195
{
196196
int i;
197197

198-
if (sub_header->rects != NULL) {
198+
if (sub_header->rects) {
199199
for (i = 0; i < sub_header->num_rects; i++) {
200200
av_freep(&sub_header->rects[i]->pict.data[0]);
201201
av_freep(&sub_header->rects[i]->pict.data[1]);
@@ -414,7 +414,7 @@ static int find_smallest_bounding_rectangle(AVSubtitle *s)
414414
int y1, y2, x1, x2, y, w, h, i;
415415
uint8_t *bitmap;
416416

417-
if (s->num_rects == 0 || s->rects == NULL || s->rects[0]->w <= 0 || s->rects[0]->h <= 0)
417+
if (s->num_rects == 0 || !s->rects || s->rects[0]->w <= 0 || s->rects[0]->h <= 0)
418418
return 0;
419419

420420
for(i = 0; i < s->rects[0]->nb_colors; i++) {

0 commit comments

Comments
 (0)