From f929ab0569ff31ed5a59b0b0adb7ce09df3fca39 Mon Sep 17 00:00:00 2001 From: Gabriel Dume Date: Thu, 14 Aug 2014 16:31:24 -0400 Subject: [PATCH] cosmetics: Write NULL pointer equality checks more compactly Signed-off-by: Diego Biurrun --- avconv.c | 2 +- avconv_opt.c | 2 +- avplay.c | 2 +- cmdutils.c | 8 ++++---- compat/getopt.c | 2 +- libavcodec/atrac3.c | 2 +- libavcodec/cook.c | 2 +- libavcodec/dvbsub.c | 2 +- libavcodec/dvdsubdec.c | 4 ++-- libavcodec/dvdsubenc.c | 2 +- libavcodec/dxa.c | 2 +- libavcodec/h263dec.c | 4 ++-- libavcodec/h264.c | 6 +++--- libavcodec/h264_parser.c | 2 +- libavcodec/h264_ps.c | 2 +- libavcodec/h264_refs.c | 2 +- libavcodec/huffyuvdec.c | 2 +- libavcodec/interplayvideo.c | 2 +- libavcodec/lcldec.c | 2 +- libavcodec/libmp3lame.c | 2 +- libavcodec/libxvid.c | 10 +++++----- libavcodec/libxvid_rc.c | 2 +- libavcodec/motion_est.c | 2 +- libavcodec/mpeg12dec.c | 4 ++-- libavcodec/mpegaudiodec_template.c | 2 +- libavcodec/mpegvideo.c | 17 +++++++---------- libavcodec/mpegvideo_enc.c | 6 +++--- libavcodec/options.c | 3 ++- libavcodec/opus_celt.c | 2 +- libavcodec/qdm2.c | 2 +- libavcodec/roqvideo.c | 2 +- libavcodec/rv10.c | 4 ++-- libavcodec/tiffenc.c | 2 +- libavcodec/tscc.c | 2 +- libavcodec/utils.c | 2 +- libavcodec/vc1dec.c | 2 +- libavcodec/vp3.c | 2 +- libavcodec/vp8.c | 2 +- libavcodec/zmbv.c | 4 ++-- libavcodec/zmbvenc.c | 6 +++--- libavdevice/v4l2.c | 6 +++--- libavformat/avs.c | 4 ++-- libavformat/matroskadec.c | 16 ++++++++-------- libavformat/matroskaenc.c | 6 +++--- libavformat/movenc.c | 4 ++-- libavformat/mpegts.c | 2 +- libavformat/nsvdec.c | 2 +- libavformat/rtpenc.c | 2 +- libavformat/rtspdec.c | 2 +- libavformat/rtspenc.c | 2 +- libavformat/sdp.c | 8 ++++---- libavutil/eval.c | 2 +- libavutil/internal.h | 4 ++-- 53 files changed, 95 insertions(+), 97 deletions(-) diff --git a/avconv.c b/avconv.c index 65f33b2d1e..634101a452 100644 --- a/avconv.c +++ b/avconv.c @@ -1363,7 +1363,7 @@ static int process_input_packet(InputStream *ist, const AVPacket *pkt) if (ist->next_dts == AV_NOPTS_VALUE) ist->next_dts = ist->last_dts; - if (pkt == NULL) { + if (!pkt) { /* EOF handling */ av_init_packet(&avpkt); avpkt.data = NULL; diff --git a/avconv_opt.c b/avconv_opt.c index 434ba0b2e7..f070b99b1c 100644 --- a/avconv_opt.c +++ b/avconv_opt.c @@ -587,7 +587,7 @@ static void assert_file_overwrite(const char *filename) } if (!file_overwrite && - (strchr(filename, ':') == NULL || filename[1] == ':' || + (!strchr(filename, ':') || filename[1] == ':' || av_strstart(filename, "file:", NULL))) { if (avio_check(filename, 0) == 0) { if (!using_stdin && !file_skip) { diff --git a/avplay.c b/avplay.c index 2db892849b..816733fe43 100644 --- a/avplay.c +++ b/avplay.c @@ -1388,7 +1388,7 @@ static int queue_picture(VideoState *is, AVFrame *src_frame, double pts, int64_t is->img_convert_ctx = sws_getCachedContext(is->img_convert_ctx, vp->width, vp->height, vp->pix_fmt, vp->width, vp->height, dst_pix_fmt, sws_flags, NULL, NULL, NULL); - if (is->img_convert_ctx == NULL) { + if (!is->img_convert_ctx) { fprintf(stderr, "Cannot initialize the conversion context\n"); exit(1); } diff --git a/cmdutils.c b/cmdutils.c index b208e52d68..b1671a49f5 100644 --- a/cmdutils.c +++ b/cmdutils.c @@ -225,7 +225,7 @@ static void prepare_app_arguments(int *argc_ptr, char ***argv_ptr) win32_argv_utf8 = av_mallocz(sizeof(char *) * (win32_argc + 1) + buffsize); argstr_flat = (char *)win32_argv_utf8 + sizeof(char *) * (win32_argc + 1); - if (win32_argv_utf8 == NULL) { + if (!win32_argv_utf8) { LocalFree(argv_w); return; } @@ -920,7 +920,7 @@ int show_formats(void *optctx, const char *opt, const char *arg) const char *long_name = NULL; while ((ofmt = av_oformat_next(ofmt))) { - if ((name == NULL || strcmp(ofmt->name, name) < 0) && + if ((!name || strcmp(ofmt->name, name) < 0) && strcmp(ofmt->name, last_name) > 0) { name = ofmt->name; long_name = ofmt->long_name; @@ -928,7 +928,7 @@ int show_formats(void *optctx, const char *opt, const char *arg) } } while ((ifmt = av_iformat_next(ifmt))) { - if ((name == NULL || strcmp(ifmt->name, name) < 0) && + if ((!name || strcmp(ifmt->name, name) < 0) && strcmp(ifmt->name, last_name) > 0) { name = ifmt->name; long_name = ifmt->long_name; @@ -937,7 +937,7 @@ int show_formats(void *optctx, const char *opt, const char *arg) if (name && strcmp(ifmt->name, name) == 0) decode = 1; } - if (name == NULL) + if (!name) break; last_name = name; diff --git a/compat/getopt.c b/compat/getopt.c index 7c646f6a05..b7adf60e2f 100644 --- a/compat/getopt.c +++ b/compat/getopt.c @@ -53,7 +53,7 @@ static int getopt(int argc, char *argv[], char *opts) return EOF; } optopt = c = argv[optind][sp]; - if (c == ':' || (cp = strchr(opts, c)) == NULL) { + if (c == ':' || !(cp = strchr(opts, c))) { fprintf(stderr, ": illegal option -- %c\n", c); if (argv[optind][++sp] == '\0') { optind++; diff --git a/libavcodec/atrac3.c b/libavcodec/atrac3.c index 76fd0d141d..31f484464e 100644 --- a/libavcodec/atrac3.c +++ b/libavcodec/atrac3.c @@ -882,7 +882,7 @@ static av_cold int atrac3_decode_init(AVCodecContext *avctx) q->decoded_bytes_buffer = av_mallocz(FFALIGN(avctx->block_align, 4) + FF_INPUT_BUFFER_PADDING_SIZE); - if (q->decoded_bytes_buffer == NULL) + if (!q->decoded_bytes_buffer) return AVERROR(ENOMEM); avctx->sample_fmt = AV_SAMPLE_FMT_FLTP; diff --git a/libavcodec/cook.c b/libavcodec/cook.c index 2d77899c55..056c7d90f6 100644 --- a/libavcodec/cook.c +++ b/libavcodec/cook.c @@ -1218,7 +1218,7 @@ static av_cold int cook_decode_init(AVCodecContext *avctx) av_mallocz(avctx->block_align + DECODE_BYTES_PAD1(avctx->block_align) + FF_INPUT_BUFFER_PADDING_SIZE); - if (q->decoded_bytes_buffer == NULL) + if (!q->decoded_bytes_buffer) return AVERROR(ENOMEM); /* Initialize transform. */ diff --git a/libavcodec/dvbsub.c b/libavcodec/dvbsub.c index de0808fff5..720e78669a 100644 --- a/libavcodec/dvbsub.c +++ b/libavcodec/dvbsub.c @@ -205,7 +205,7 @@ static int encode_dvb_subtitles(DVBSubtitleContext *s, page_id = 1; - if (h->num_rects == 0 || h->rects == NULL) + if (h->num_rects == 0 || !h->rects) return -1; *q++ = 0x00; /* subtitle_stream_id */ diff --git a/libavcodec/dvdsubdec.c b/libavcodec/dvdsubdec.c index 02f70be906..856d666b04 100644 --- a/libavcodec/dvdsubdec.c +++ b/libavcodec/dvdsubdec.c @@ -360,7 +360,7 @@ static int decode_dvd_subtitles(DVDSubContext *ctx, AVSubtitle *sub_header, if (sub_header->num_rects > 0) return is_menu; fail: - if (sub_header->rects != NULL) { + if (!sub_header->rects) { for (i = 0; i < sub_header->num_rects; i++) { av_freep(&sub_header->rects[i]->pict.data[0]); av_freep(&sub_header->rects[i]->pict.data[1]); @@ -391,7 +391,7 @@ static int find_smallest_bounding_rectangle(AVSubtitle *s) int y1, y2, x1, x2, y, w, h, i; uint8_t *bitmap; - if (s->num_rects == 0 || s->rects == NULL || s->rects[0]->w <= 0 || s->rects[0]->h <= 0) + if (s->num_rects == 0 || !s->rects || s->rects[0]->w <= 0 || s->rects[0]->h <= 0) return 0; for(i = 0; i < s->rects[0]->nb_colors; i++) { diff --git a/libavcodec/dvdsubenc.c b/libavcodec/dvdsubenc.c index db6749e59d..f62e943e7f 100644 --- a/libavcodec/dvdsubenc.c +++ b/libavcodec/dvdsubenc.c @@ -97,7 +97,7 @@ static int encode_dvd_subtitles(uint8_t *outbuf, int outbuf_size, unsigned long hist[256]; int cmap[256]; - if (rects == 0 || h->rects == NULL) + if (rects == 0 || !h->rects) return -1; if (rects > 20) rects = 20; diff --git a/libavcodec/dxa.c b/libavcodec/dxa.c index fa0677d34c..989fcb965b 100644 --- a/libavcodec/dxa.c +++ b/libavcodec/dxa.c @@ -309,7 +309,7 @@ static av_cold int decode_init(AVCodecContext *avctx) avctx->pix_fmt = AV_PIX_FMT_PAL8; c->dsize = avctx->width * avctx->height * 2; - if((c->decomp_buf = av_malloc(c->dsize)) == NULL) { + if (!(c->decomp_buf = av_malloc(c->dsize))) { av_log(avctx, AV_LOG_ERROR, "Can't allocate decompression buffer.\n"); return AVERROR(ENOMEM); } diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c index a9cdb9e37d..e7ce56c699 100644 --- a/libavcodec/h263dec.c +++ b/libavcodec/h263dec.c @@ -457,7 +457,7 @@ int ff_h263_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, if ((ret = ff_mpv_common_init(s)) < 0) return ret; - if (s->current_picture_ptr == NULL || s->current_picture_ptr->f->data[0]) { + if (!s->current_picture_ptr || s->current_picture_ptr->f->data[0]) { int i = ff_find_unused_picture(s, 0); if (i < 0) return i; @@ -517,7 +517,7 @@ int ff_h263_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, s->current_picture.f->key_frame = s->pict_type == AV_PICTURE_TYPE_I; /* skip B-frames if we don't have reference frames */ - if (s->last_picture_ptr == NULL && + if (!s->last_picture_ptr && (s->pict_type == AV_PICTURE_TYPE_B || s->droppable)) return get_consumed_bytes(s, buf_size); if ((avctx->skip_frame >= AVDISCARD_NONREF && diff --git a/libavcodec/h264.c b/libavcodec/h264.c index 7d1109cb89..1fd5e506cd 100644 --- a/libavcodec/h264.c +++ b/libavcodec/h264.c @@ -286,7 +286,7 @@ const uint8_t *ff_h264_decode_nal(H264Context *h, const uint8_t *src, length + FF_INPUT_BUFFER_PADDING_SIZE); dst = h->rbsp_buffer[bufidx]; - if (dst == NULL) + if (!dst) return NULL; memcpy(dst, src, i); @@ -1379,7 +1379,7 @@ static int get_last_needed_nal(H264Context *h, const uint8_t *buf, int buf_size) ptr = ff_h264_decode_nal(h, buf + buf_index, &dst_length, &consumed, next_avc - buf_index); - if (ptr == NULL || dst_length < 0) + if (!ptr || dst_length < 0) return AVERROR_INVALIDDATA; buf_index += consumed; @@ -1460,7 +1460,7 @@ static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size, ptr = ff_h264_decode_nal(hx, buf + buf_index, &dst_length, &consumed, next_avc - buf_index); - if (ptr == NULL || dst_length < 0) { + if (!ptr || dst_length < 0) { ret = -1; goto end; } diff --git a/libavcodec/h264_parser.c b/libavcodec/h264_parser.c index 8ced0b811d..145dce3b0c 100644 --- a/libavcodec/h264_parser.c +++ b/libavcodec/h264_parser.c @@ -215,7 +215,7 @@ static inline int parse_nal_units(AVCodecParserContext *s, break; } ptr = ff_h264_decode_nal(h, buf, &dst_length, &consumed, src_length); - if (ptr == NULL || dst_length < 0) + if (!ptr || dst_length < 0) break; init_get_bits(&h->gb, ptr, 8 * dst_length); diff --git a/libavcodec/h264_ps.c b/libavcodec/h264_ps.c index 183cc44ea3..b439fa8e4a 100644 --- a/libavcodec/h264_ps.c +++ b/libavcodec/h264_ps.c @@ -553,7 +553,7 @@ int ff_h264_decode_picture_parameter_set(H264Context *h, int bit_length) return AVERROR(ENOMEM); pps->sps_id = get_ue_golomb_31(&h->gb); if ((unsigned)pps->sps_id >= MAX_SPS_COUNT || - h->sps_buffers[pps->sps_id] == NULL) { + !h->sps_buffers[pps->sps_id]) { av_log(h->avctx, AV_LOG_ERROR, "sps_id %u out of range\n", pps->sps_id); goto fail; } diff --git a/libavcodec/h264_refs.c b/libavcodec/h264_refs.c index ffe1fcc0b0..af7fa7b523 100644 --- a/libavcodec/h264_refs.c +++ b/libavcodec/h264_refs.c @@ -759,7 +759,7 @@ int ff_h264_decode_ref_pic_marking(H264Context *h, GetBitContext *gb, (h->max_pic_num - 1); #if 0 if (mmco[i].short_pic_num >= h->short_ref_count || - h->short_ref[ mmco[i].short_pic_num ] == NULL){ + !h->short_ref[ mmco[i].short_pic_num ]) { av_log(s->avctx, AV_LOG_ERROR, "illegal short ref in memory management control " "operation %d\n", mmco); diff --git a/libavcodec/huffyuvdec.c b/libavcodec/huffyuvdec.c index d8f31d3dd7..1ad81f7dd7 100644 --- a/libavcodec/huffyuvdec.c +++ b/libavcodec/huffyuvdec.c @@ -472,7 +472,7 @@ static void draw_slice(HYuvContext *s, AVFrame *frame, int y) int h, cy, i; int offset[AV_NUM_DATA_POINTERS]; - if (s->avctx->draw_horiz_band == NULL) + if (!s->avctx->draw_horiz_band) return; h = y - s->last_slice_end; diff --git a/libavcodec/interplayvideo.c b/libavcodec/interplayvideo.c index 7d785e3764..af7aa130d1 100644 --- a/libavcodec/interplayvideo.c +++ b/libavcodec/interplayvideo.c @@ -79,7 +79,7 @@ static int copy_from(IpvideoContext *s, AVFrame *src, AVFrame *dst, int delta_x, motion_offset, s->upper_motion_limit_offset); return AVERROR_INVALIDDATA; } - if (src->data[0] == NULL) { + if (!src->data[0]) { av_log(s->avctx, AV_LOG_ERROR, "Invalid decode type, corrupted header?\n"); return AVERROR(EINVAL); } diff --git a/libavcodec/lcldec.c b/libavcodec/lcldec.c index 8923341f03..9c606976e7 100644 --- a/libavcodec/lcldec.c +++ b/libavcodec/lcldec.c @@ -571,7 +571,7 @@ static av_cold int decode_init(AVCodecContext *avctx) /* Allocate decompression buffer */ if (c->decomp_size) { - if ((c->decomp_buf = av_malloc(max_decomp_size)) == NULL) { + if (!(c->decomp_buf = av_malloc(max_decomp_size))) { av_log(avctx, AV_LOG_ERROR, "Can't allocate decompression buffer.\n"); return AVERROR(ENOMEM); } diff --git a/libavcodec/libmp3lame.c b/libavcodec/libmp3lame.c index dee1909609..b7a323a8a0 100644 --- a/libavcodec/libmp3lame.c +++ b/libavcodec/libmp3lame.c @@ -94,7 +94,7 @@ static av_cold int mp3lame_encode_init(AVCodecContext *avctx) s->avctx = avctx; /* initialize LAME and get defaults */ - if ((s->gfp = lame_init()) == NULL) + if (!(s->gfp = lame_init())) return AVERROR(ENOMEM); lame_set_num_channels(s->gfp, avctx->channels); diff --git a/libavcodec/libxvid.c b/libavcodec/libxvid.c index ddeceacf36..f4935b836f 100644 --- a/libavcodec/libxvid.c +++ b/libavcodec/libxvid.c @@ -98,7 +98,7 @@ static int xvid_ff_2pass_create(xvid_plg_create_t * param, char *log = x->context->twopassbuffer; /* Do a quick bounds check */ - if( log == NULL ) + if (!log) return XVID_ERR_FAIL; /* We use snprintf() */ @@ -189,7 +189,7 @@ static int xvid_ff_2pass_after(struct xvid_context *ref, char frame_type; /* Quick bounds check */ - if( log == NULL ) + if (!log) return XVID_ERR_FAIL; /* Convert the type given to us into a character */ @@ -273,7 +273,7 @@ static int xvid_strip_vol_header(AVCodecContext *avctx, if( vo_len > 0 ) { /* We need to store the header, so extract it */ - if( avctx->extradata == NULL ) { + if (!avctx->extradata) { avctx->extradata = av_malloc(vo_len); memcpy(avctx->extradata, pkt->data, vo_len); avctx->extradata_size = vo_len; @@ -470,7 +470,7 @@ static av_cold int xvid_encode_init(AVCodecContext *avctx) { rc2pass1.context = x; x->twopassbuffer = av_malloc(BUFFER_SIZE); x->old_twopassbuffer = av_malloc(BUFFER_SIZE); - if( x->twopassbuffer == NULL || x->old_twopassbuffer == NULL ) { + if (!x->twopassbuffer || !x->old_twopassbuffer) { av_log(avctx, AV_LOG_ERROR, "Xvid: Cannot allocate 2-pass log buffers\n"); return -1; @@ -491,7 +491,7 @@ static av_cold int xvid_encode_init(AVCodecContext *avctx) { return -1; } - if( avctx->stats_in == NULL ) { + if (!avctx->stats_in) { av_log(avctx, AV_LOG_ERROR, "Xvid: No 2-pass information loaded for second pass\n"); return -1; diff --git a/libavcodec/libxvid_rc.c b/libavcodec/libxvid_rc.c index 7f4a89d25d..a17a776fe1 100644 --- a/libavcodec/libxvid_rc.c +++ b/libavcodec/libxvid_rc.c @@ -50,7 +50,7 @@ int ff_tempfile(const char *prefix, char **filename) { *filename = av_malloc(len); #endif /* -----common section-----*/ - if (*filename == NULL) { + if (!(*filename)) { av_log(NULL, AV_LOG_ERROR, "ff_tempfile: Cannot allocate file name\n"); return -1; } diff --git a/libavcodec/motion_est.c b/libavcodec/motion_est.c index 26cde77d3c..21d2c04544 100644 --- a/libavcodec/motion_est.c +++ b/libavcodec/motion_est.c @@ -1731,7 +1731,7 @@ void ff_fix_long_mvs(MpegEncContext * s, uint8_t *field_select_table, int field_ int xy= y*s->mb_stride; for(x=0; xmb_width; x++){ if (s->mb_type[xy] & type){ // RAL: "type" test added... - if(field_select_table==NULL || field_select_table[xy] == field_select){ + if (!field_select_table || field_select_table[xy] == field_select) { if( mv_table[xy][0] >=h_range || mv_table[xy][0] <-h_range || mv_table[xy][1] >=v_range || mv_table[xy][1] <-v_range){ diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c index 5a875c2518..2b86ea87fe 100644 --- a/libavcodec/mpeg12dec.c +++ b/libavcodec/mpeg12dec.c @@ -2488,7 +2488,7 @@ static int decode_chunks(AVCodecContext *avctx, AVFrame *picture, return -1; } - if (s2->last_picture_ptr == NULL) { + if (!s2->last_picture_ptr) { /* Skip B-frames if we do not have reference frames and * GOP is not closed. */ if (s2->pict_type == AV_PICTURE_TYPE_B) { @@ -2500,7 +2500,7 @@ static int decode_chunks(AVCodecContext *avctx, AVFrame *picture, } if (s2->pict_type == AV_PICTURE_TYPE_I) s->sync = 1; - if (s2->next_picture_ptr == NULL) { + if (!s2->next_picture_ptr) { /* Skip P-frames if we do not have a reference frame or * we have an invalid header. */ if (s2->pict_type == AV_PICTURE_TYPE_P && !s->sync) { diff --git a/libavcodec/mpegaudiodec_template.c b/libavcodec/mpegaudiodec_template.c index 9ce03efcc8..e9c7850277 100644 --- a/libavcodec/mpegaudiodec_template.c +++ b/libavcodec/mpegaudiodec_template.c @@ -1803,7 +1803,7 @@ static av_cold int decode_init_mp3on4(AVCodecContext * avctx) MPEG4AudioConfig cfg; int i; - if ((avctx->extradata_size < 2) || (avctx->extradata == NULL)) { + if ((avctx->extradata_size < 2) || !avctx->extradata) { av_log(avctx, AV_LOG_ERROR, "Codec extradata missing or too short.\n"); return AVERROR_INVALIDDATA; } diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c index b0136c7431..c60389bd87 100644 --- a/libavcodec/mpegvideo.c +++ b/libavcodec/mpegvideo.c @@ -826,7 +826,7 @@ fail: static void free_duplicate_context(MpegEncContext *s) { - if (s == NULL) + if (!s) return; av_freep(&s->edge_emu_buffer); @@ -1630,7 +1630,7 @@ static void release_unused_pictures(MpegEncContext *s) static inline int pic_is_unused(MpegEncContext *s, Picture *pic) { - if (pic->f->buf[0] == NULL) + if (!pic->f->buf[0]) return 1; if (pic->needs_realloc && !(pic->reference & DELAYED_PIC_REF)) return 1; @@ -1643,7 +1643,7 @@ static int find_unused_picture(MpegEncContext *s, int shared) if (shared) { for (i = 0; i < MAX_PICTURE_COUNT; i++) { - if (s->picture[i].f->buf[0] == NULL) + if (!s->picture[i].f->buf[0]) return i; } } else { @@ -1704,8 +1704,7 @@ int ff_mpv_frame_start(MpegEncContext *s, AVCodecContext *avctx) release_unused_pictures(s); - if (s->current_picture_ptr && - s->current_picture_ptr->f->buf[0] == NULL) { + if (s->current_picture_ptr && !s->current_picture_ptr->f->buf[0]) { // we already have a unused image // (maybe it was set before reading the header) pic = s->current_picture_ptr; @@ -1763,8 +1762,7 @@ int ff_mpv_frame_start(MpegEncContext *s, AVCodecContext *avctx) s->current_picture_ptr ? s->current_picture_ptr->f->data[0] : NULL, s->pict_type, s->droppable); - if ((s->last_picture_ptr == NULL || - s->last_picture_ptr->f->buf[0] == NULL) && + if ((!s->last_picture_ptr || !s->last_picture_ptr->f->buf[0]) && (s->pict_type != AV_PICTURE_TYPE_I || s->picture_structure != PICT_FRAME)) { int h_chroma_shift, v_chroma_shift; @@ -1805,8 +1803,7 @@ int ff_mpv_frame_start(MpegEncContext *s, AVCodecContext *avctx) ff_thread_report_progress(&s->last_picture_ptr->tf, INT_MAX, 0); ff_thread_report_progress(&s->last_picture_ptr->tf, INT_MAX, 1); } - if ((s->next_picture_ptr == NULL || - s->next_picture_ptr->f->buf[0] == NULL) && + if ((!s->next_picture_ptr || !s->next_picture_ptr->f->buf[0]) && s->pict_type == AV_PICTURE_TYPE_B) { /* Allocate a dummy frame */ i = ff_find_unused_picture(s, 0); @@ -2433,7 +2430,7 @@ void ff_mpeg_flush(AVCodecContext *avctx){ int i; MpegEncContext *s = avctx->priv_data; - if(s==NULL || s->picture==NULL) + if (!s || !s->picture) return; for (i = 0; i < MAX_PICTURE_COUNT; i++) diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c index fd84deb584..380eff67da 100644 --- a/libavcodec/mpegvideo_enc.c +++ b/libavcodec/mpegvideo_enc.c @@ -1221,9 +1221,9 @@ static int select_input_picture(MpegEncContext *s) s->reordered_input_picture[MAX_PICTURE_COUNT - 1] = NULL; /* set next picture type & ordering */ - if (s->reordered_input_picture[0] == NULL && s->input_picture[0]) { + if (!s->reordered_input_picture[0] && s->input_picture[0]) { if (/*s->picture_in_gop_number >= s->gop_size ||*/ - s->next_picture_ptr == NULL || s->intra_only) { + !s->next_picture_ptr || s->intra_only) { s->reordered_input_picture[0] = s->input_picture[0]; s->reordered_input_picture[0]->f->pict_type = AV_PICTURE_TYPE_I; s->reordered_input_picture[0]->f->coded_picture_number = @@ -1276,7 +1276,7 @@ static int select_input_picture(MpegEncContext *s) } } for (i = 0; i < s->max_b_frames + 1; i++) { - if (s->input_picture[i] == NULL || + if (!s->input_picture[i] || s->input_picture[i]->b_frame_score - 1 > s->mb_num / s->avctx->b_sensitivity) break; diff --git a/libavcodec/options.c b/libavcodec/options.c index e3ded738bb..f428976086 100644 --- a/libavcodec/options.c +++ b/libavcodec/options.c @@ -125,7 +125,8 @@ AVCodecContext *avcodec_alloc_context3(const AVCodec *codec) { AVCodecContext *avctx= av_malloc(sizeof(AVCodecContext)); - if(avctx==NULL) return NULL; + if (!avctx) + return NULL; if(avcodec_get_context_defaults3(avctx, codec) < 0){ av_free(avctx); diff --git a/libavcodec/opus_celt.c b/libavcodec/opus_celt.c index e77ca6f69a..af3e549251 100644 --- a/libavcodec/opus_celt.c +++ b/libavcodec/opus_celt.c @@ -1608,7 +1608,7 @@ static unsigned int celt_decode_band(CeltContext *s, OpusRangeCoder *rc, for (j = 0; j < N; j++) X[j] = 0.0f; } else { - if (lowband == NULL) { + if (!lowband) { /* Noise */ for (j = 0; j < N; j++) X[j] = (((int32_t)celt_rng(s)) >> 20); diff --git a/libavcodec/qdm2.c b/libavcodec/qdm2.c index 04e7def067..3041182e25 100644 --- a/libavcodec/qdm2.c +++ b/libavcodec/qdm2.c @@ -1464,7 +1464,7 @@ static void qdm2_decode_fft_packets(QDM2Context *q) int i, j, min, max, value, type, unknown_flag; GetBitContext gb; - if (q->sub_packet_list_B[0].packet == NULL) + if (!q->sub_packet_list_B[0].packet) return; /* reset minimum indexes for FFT coefficients */ diff --git a/libavcodec/roqvideo.c b/libavcodec/roqvideo.c index 77df0798db..b0fd6ba7f3 100644 --- a/libavcodec/roqvideo.c +++ b/libavcodec/roqvideo.c @@ -115,7 +115,7 @@ static inline void apply_motion_generic(RoqContext *ri, int x, int y, int deltax return; } - if (ri->last_frame->data[0] == NULL) { + if (!ri->last_frame->data[0]) { av_log(ri->avctx, AV_LOG_ERROR, "Invalid decode type. Invalid header?\n"); return; } diff --git a/libavcodec/rv10.c b/libavcodec/rv10.c index 1787a7e78e..2b571c9ba2 100644 --- a/libavcodec/rv10.c +++ b/libavcodec/rv10.c @@ -326,7 +326,7 @@ static int rv20_decode_picture_header(RVDecContext *rv) return AVERROR_INVALIDDATA; } - if (s->last_picture_ptr == NULL && s->pict_type == AV_PICTURE_TYPE_B) { + if (!s->last_picture_ptr && s->pict_type == AV_PICTURE_TYPE_B) { av_log(s->avctx, AV_LOG_ERROR, "early B-frame\n"); return AVERROR_INVALIDDATA; } @@ -557,7 +557,7 @@ static int rv10_decode_packet(AVCodecContext *avctx, const uint8_t *buf, return AVERROR_INVALIDDATA; } - if ((s->mb_x == 0 && s->mb_y == 0) || s->current_picture_ptr == NULL) { + if ((s->mb_x == 0 && s->mb_y == 0) || !s->current_picture_ptr) { // FIXME write parser so we always have complete frames? if (s->current_picture_ptr) { ff_er_frame_end(&s->er); diff --git a/libavcodec/tiffenc.c b/libavcodec/tiffenc.c index f450edb10f..93c151e167 100644 --- a/libavcodec/tiffenc.c +++ b/libavcodec/tiffenc.c @@ -323,7 +323,7 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, s->subsampling[0] * s->subsampling[1] + 7) >> 3; if (is_yuv) { yuv_line = av_malloc(bytes_per_row); - if (yuv_line == NULL) { + if (!yuv_line) { av_log(s->avctx, AV_LOG_ERROR, "Not enough memory\n"); ret = AVERROR(ENOMEM); goto fail; diff --git a/libavcodec/tscc.c b/libavcodec/tscc.c index 16d0770bf6..86199342a9 100644 --- a/libavcodec/tscc.c +++ b/libavcodec/tscc.c @@ -142,7 +142,7 @@ static av_cold int decode_init(AVCodecContext *avctx) /* Allocate decompression buffer */ if (c->decomp_size) { - if ((c->decomp_buf = av_malloc(c->decomp_size)) == NULL) { + if (!(c->decomp_buf = av_malloc(c->decomp_size))) { av_log(avctx, AV_LOG_ERROR, "Can't allocate decompression buffer.\n"); return AVERROR(ENOMEM); } diff --git a/libavcodec/utils.c b/libavcodec/utils.c index 4253e8cf6c..7e116ed9e2 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -954,7 +954,7 @@ AVFrame *avcodec_alloc_frame(void) { AVFrame *frame = av_mallocz(sizeof(AVFrame)); - if (frame == NULL) + if (!frame) return NULL; FF_DISABLE_DEPRECATION_WARNINGS diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c index 85ee9de941..2c7db0be1c 100644 --- a/libavcodec/vc1dec.c +++ b/libavcodec/vc1dec.c @@ -5964,7 +5964,7 @@ static int vc1_decode_frame(AVCodecContext *avctx, void *data, s->current_picture.f->key_frame = s->pict_type == AV_PICTURE_TYPE_I; /* skip B-frames if we don't have reference frames */ - if (s->last_picture_ptr == NULL && (s->pict_type == AV_PICTURE_TYPE_B || s->droppable)) { + if (!s->last_picture_ptr && (s->pict_type == AV_PICTURE_TYPE_B || s->droppable)) { goto end; } if ((avctx->skip_frame >= AVDISCARD_NONREF && s->pict_type == AV_PICTURE_TYPE_B) || diff --git a/libavcodec/vp3.c b/libavcodec/vp3.c index c215fbb4f4..c2ea8222e8 100644 --- a/libavcodec/vp3.c +++ b/libavcodec/vp3.c @@ -1416,7 +1416,7 @@ static void vp3_draw_horiz_band(Vp3DecodeContext *s, int y) 0); } - if (s->avctx->draw_horiz_band == NULL) + if (!s->avctx->draw_horiz_band) return; h = y - s->last_slice_end; diff --git a/libavcodec/vp8.c b/libavcodec/vp8.c index e3c2bd930f..5426555793 100644 --- a/libavcodec/vp8.c +++ b/libavcodec/vp8.c @@ -2205,7 +2205,7 @@ static void vp8_decode_mv_mb_modes(AVCodecContext *avctx, VP8Frame *cur_frame, int pos = (mb_y << 16) | (mb_x & 0xFFFF); \ int sliced_threading = (avctx->active_thread_type == FF_THREAD_SLICE) && \ (num_jobs > 1); \ - int is_null = (next_td == NULL) || (prev_td == NULL); \ + int is_null = !next_td || !prev_td; \ int pos_check = (is_null) ? 1 \ : (next_td != td && \ pos >= next_td->wait_mb_pos) || \ diff --git a/libavcodec/zmbv.c b/libavcodec/zmbv.c index d17f37a59f..f49cbdb014 100644 --- a/libavcodec/zmbv.c +++ b/libavcodec/zmbv.c @@ -493,7 +493,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPac c->by = (c->height + c->bh - 1) / c->bh; } - if (c->decode_intra == NULL) { + if (!c->decode_intra) { av_log(avctx, AV_LOG_ERROR, "Error! Got no format or no keyframe!\n"); return AVERROR_INVALIDDATA; } @@ -621,7 +621,7 @@ static av_cold int decode_init(AVCodecContext *avctx) /* Allocate decompression buffer */ if (c->decomp_size) { - if ((c->decomp_buf = av_malloc(c->decomp_size)) == NULL) { + if (!(c->decomp_buf = av_malloc(c->decomp_size))) { av_log(avctx, AV_LOG_ERROR, "Can't allocate decompression buffer.\n"); return AVERROR(ENOMEM); diff --git a/libavcodec/zmbvenc.c b/libavcodec/zmbvenc.c index 785ee0a409..d7b518db26 100644 --- a/libavcodec/zmbvenc.c +++ b/libavcodec/zmbvenc.c @@ -298,7 +298,7 @@ static av_cold int encode_init(AVCodecContext *avctx) memset(&c->zstream, 0, sizeof(z_stream)); c->comp_size = avctx->width * avctx->height + 1024 + ((avctx->width + ZMBV_BLOCK - 1) / ZMBV_BLOCK) * ((avctx->height + ZMBV_BLOCK - 1) / ZMBV_BLOCK) * 2 + 4; - if ((c->work_buf = av_malloc(c->comp_size)) == NULL) { + if (!(c->work_buf = av_malloc(c->comp_size))) { av_log(avctx, AV_LOG_ERROR, "Can't allocate work buffer.\n"); return AVERROR(ENOMEM); } @@ -307,12 +307,12 @@ static av_cold int encode_init(AVCodecContext *avctx) ((c->comp_size + 63) >> 6) + 11; /* Allocate compression buffer */ - if ((c->comp_buf = av_malloc(c->comp_size)) == NULL) { + if (!(c->comp_buf = av_malloc(c->comp_size))) { av_log(avctx, AV_LOG_ERROR, "Can't allocate compression buffer.\n"); return AVERROR(ENOMEM); } c->pstride = FFALIGN(avctx->width, 16); - if ((c->prev = av_malloc(c->pstride * avctx->height)) == NULL) { + if (!(c->prev = av_malloc(c->pstride * avctx->height))) { av_log(avctx, AV_LOG_ERROR, "Can't allocate picture.\n"); return AVERROR(ENOMEM); } diff --git a/libavdevice/v4l2.c b/libavdevice/v4l2.c index adb289d140..e210dc4b29 100644 --- a/libavdevice/v4l2.c +++ b/libavdevice/v4l2.c @@ -361,13 +361,13 @@ static int mmap_init(AVFormatContext *ctx) } s->buffers = req.count; s->buf_start = av_malloc(sizeof(void *) * s->buffers); - if (s->buf_start == NULL) { + if (!s->buf_start) { av_log(ctx, AV_LOG_ERROR, "Cannot allocate buffer pointers\n"); return AVERROR(ENOMEM); } s->buf_len = av_malloc(sizeof(unsigned int) * s->buffers); - if (s->buf_len == NULL) { + if (!s->buf_len) { av_log(ctx, AV_LOG_ERROR, "Cannot allocate buffer sizes\n"); av_free(s->buf_start); @@ -513,7 +513,7 @@ FF_ENABLE_DEPRECATION_WARNINGS #endif buf_descriptor = av_malloc(sizeof(struct buff_data)); - if (buf_descriptor == NULL) { + if (!buf_descriptor) { /* Something went wrong... Since av_malloc() failed, we cannot even * allocate a buffer for memcpying into it */ diff --git a/libavformat/avs.c b/libavformat/avs.c index 3e95a3656a..d8042c51f9 100644 --- a/libavformat/avs.c +++ b/libavformat/avs.c @@ -182,7 +182,7 @@ static int avs_read_packet(AVFormatContext * s, AVPacket * pkt) case AVS_VIDEO: if (!avs->st_video) { avs->st_video = avformat_new_stream(s, NULL); - if (avs->st_video == NULL) + if (!avs->st_video) return AVERROR(ENOMEM); avs->st_video->codec->codec_type = AVMEDIA_TYPE_VIDEO; avs->st_video->codec->codec_id = AV_CODEC_ID_AVS; @@ -198,7 +198,7 @@ static int avs_read_packet(AVFormatContext * s, AVPacket * pkt) case AVS_AUDIO: if (!avs->st_audio) { avs->st_audio = avformat_new_stream(s, NULL); - if (avs->st_audio == NULL) + if (!avs->st_audio) return AVERROR(ENOMEM); avs->st_audio->codec->codec_type = AVMEDIA_TYPE_AUDIO; } diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c index f15b0b3e9f..b168bdf9a6 100644 --- a/libavformat/matroskadec.c +++ b/libavformat/matroskadec.c @@ -1519,7 +1519,7 @@ static int matroska_parse_tracks(AVFormatContext *s) track->type); continue; } - if (track->codec_id == NULL) + if (!track->codec_id) continue; if (track->type == MATROSKA_TRACK_TYPE_VIDEO) { @@ -1578,7 +1578,7 @@ static int matroska_parse_tracks(AVFormatContext *s) } st = track->stream = avformat_new_stream(s, NULL); - if (st == NULL) + if (!st) return AVERROR(ENOMEM); if (!strcmp(track->codec_id, "V_MS/VFW/FOURCC") && @@ -1638,7 +1638,7 @@ static int matroska_parse_tracks(AVFormatContext *s) int profile = matroska_aac_profile(track->codec_id); int sri = matroska_aac_sri(track->audio.samplerate); extradata = av_mallocz(5 + FF_INPUT_BUFFER_PADDING_SIZE); - if (extradata == NULL) + if (!extradata) return AVERROR(ENOMEM); extradata[0] = (profile << 3) | ((sri & 0x0E) >> 1); extradata[1] = ((sri & 0x01) << 7) | (track->audio.channels << 3); @@ -1657,7 +1657,7 @@ static int matroska_parse_tracks(AVFormatContext *s) extradata_size = 12 + track->codec_priv.size; extradata = av_mallocz(extradata_size + FF_INPUT_BUFFER_PADDING_SIZE); - if (extradata == NULL) + if (!extradata) return AVERROR(ENOMEM); AV_WB32(extradata, extradata_size); memcpy(&extradata[4], "alac", 4); @@ -1667,7 +1667,7 @@ static int matroska_parse_tracks(AVFormatContext *s) } else if (codec_id == AV_CODEC_ID_TTA) { extradata_size = 30; extradata = av_mallocz(extradata_size); - if (extradata == NULL) + if (!extradata) return AVERROR(ENOMEM); ffio_init_context(&b, extradata, extradata_size, 1, NULL, NULL, NULL, NULL); @@ -1760,7 +1760,7 @@ static int matroska_parse_tracks(AVFormatContext *s) } else if (track->codec_priv.data && track->codec_priv.size > 0) { st->codec->extradata = av_mallocz(track->codec_priv.size + FF_INPUT_BUFFER_PADDING_SIZE); - if (st->codec->extradata == NULL) + if (!st->codec->extradata) return AVERROR(ENOMEM); st->codec->extradata_size = track->codec_priv.size; memcpy(st->codec->extradata, @@ -1872,14 +1872,14 @@ static int matroska_read_header(AVFormatContext *s) av_log(matroska->ctx, AV_LOG_ERROR, "incomplete attachment\n"); } else { AVStream *st = avformat_new_stream(s, NULL); - if (st == NULL) + if (!st) break; av_dict_set(&st->metadata, "filename", attachments[j].filename, 0); av_dict_set(&st->metadata, "mimetype", attachments[j].mime, 0); st->codec->codec_id = AV_CODEC_ID_NONE; st->codec->codec_type = AVMEDIA_TYPE_ATTACHMENT; st->codec->extradata = av_malloc(attachments[j].bin.size); - if (st->codec->extradata == NULL) + if (!st->codec->extradata) break; st->codec->extradata_size = attachments[j].bin.size; memcpy(st->codec->extradata, attachments[j].bin.data, diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c index b55ad35090..cc4e71a4fb 100644 --- a/libavformat/matroskaenc.c +++ b/libavformat/matroskaenc.c @@ -285,7 +285,7 @@ static mkv_seekhead *mkv_start_seekhead(AVIOContext *pb, int64_t segment_offset, int numelements) { mkv_seekhead *new_seekhead = av_mallocz(sizeof(mkv_seekhead)); - if (new_seekhead == NULL) + if (!new_seekhead) return NULL; new_seekhead->segment_offset = segment_offset; @@ -378,7 +378,7 @@ fail: static mkv_cues *mkv_start_cues(int64_t segment_offset) { mkv_cues *cues = av_mallocz(sizeof(mkv_cues)); - if (cues == NULL) + if (!cues) return NULL; cues->segment_offset = segment_offset; @@ -1109,7 +1109,7 @@ static int mkv_write_header(AVFormatContext *s) mkv_write_seekhead(pb, mkv->main_seekhead); mkv->cues = mkv_start_cues(mkv->segment_offset); - if (mkv->cues == NULL) + if (!mkv->cues) return AVERROR(ENOMEM); if (pb->seekable && mkv->reserve_cues_space) { diff --git a/libavformat/movenc.c b/libavformat/movenc.c index 4d487e979e..72dcf0a725 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -1713,7 +1713,7 @@ static int mov_write_track_udta_tag(AVIOContext *pb, MOVMuxContext *mov, int ret, size; uint8_t *buf; - if (st == NULL || mov->fc->flags & AVFMT_FLAG_BITEXACT) + if (!st || mov->fc->flags & AVFMT_FLAG_BITEXACT) return 0; ret = avio_open_dyn_buf(&pb_buf); @@ -3182,7 +3182,7 @@ static int mov_create_chapter_track(AVFormatContext *s, int tracknum) return AVERROR(ENOMEM); track->enc->codec_type = AVMEDIA_TYPE_SUBTITLE; track->enc->extradata = av_malloc(sizeof(chapter_properties)); - if (track->enc->extradata == NULL) + if (!track->enc->extradata) return AVERROR(ENOMEM); track->enc->extradata_size = sizeof(chapter_properties); memcpy(track->enc->extradata, chapter_properties, sizeof(chapter_properties)); diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c index fb58e1fc70..dced5370e4 100644 --- a/libavformat/mpegts.c +++ b/libavformat/mpegts.c @@ -1715,7 +1715,7 @@ static int handle_packet(MpegTSContext *ts, const uint8_t *packet) return 0; is_start = packet[1] & 0x40; tss = ts->pids[pid]; - if (ts->auto_guess && tss == NULL && is_start) { + if (ts->auto_guess && !tss && is_start) { add_pes_stream(ts, pid, -1); tss = ts->pids[pid]; } diff --git a/libavformat/nsvdec.c b/libavformat/nsvdec.c index 3089ffdd00..670b8678c8 100644 --- a/libavformat/nsvdec.c +++ b/libavformat/nsvdec.c @@ -663,7 +663,7 @@ static int nsv_read_packet(AVFormatContext *s, AVPacket *pkt) av_dlog(s, "%s()\n", __FUNCTION__); /* in case we don't already have something to eat ... */ - if (nsv->ahead[0].data == NULL && nsv->ahead[1].data == NULL) + if (!nsv->ahead[0].data && !nsv->ahead[1].data) err = nsv_read_chunk(s, 0); if (err < 0) return err; diff --git a/libavformat/rtpenc.c b/libavformat/rtpenc.c index 0027abd421..7bc73735c2 100644 --- a/libavformat/rtpenc.c +++ b/libavformat/rtpenc.c @@ -142,7 +142,7 @@ static int rtp_write_header(AVFormatContext *s1) return AVERROR(EIO); } s->buf = av_malloc(s1->packet_size); - if (s->buf == NULL) { + if (!s->buf) { return AVERROR(ENOMEM); } s->max_payload_size = s1->packet_size - 12; diff --git a/libavformat/rtspdec.c b/libavformat/rtspdec.c index 583070a745..a14ec579d9 100644 --- a/libavformat/rtspdec.c +++ b/libavformat/rtspdec.c @@ -408,7 +408,7 @@ static inline int parse_command_line(AVFormatContext *s, const char *line, } searchlinept = strchr(linept, ' '); - if (searchlinept == NULL) { + if (!searchlinept) { av_log(s, AV_LOG_ERROR, "Error parsing message URI\n"); return AVERROR_INVALIDDATA; } diff --git a/libavformat/rtspenc.c b/libavformat/rtspenc.c index 8a334ec49b..3db53aca07 100644 --- a/libavformat/rtspenc.c +++ b/libavformat/rtspenc.c @@ -55,7 +55,7 @@ int ff_rtsp_setup_output_streams(AVFormatContext *s, const char *addr) /* Announce the stream */ sdp = av_mallocz(SDP_MAX_SIZE); - if (sdp == NULL) + if (!sdp) return AVERROR(ENOMEM); /* We create the SDP based on the RTSP AVFormatContext where we * aren't allowed to change the filename field. (We create the SDP diff --git a/libavformat/sdp.c b/libavformat/sdp.c index 895b9d6f4c..a690219006 100644 --- a/libavformat/sdp.c +++ b/libavformat/sdp.c @@ -189,7 +189,7 @@ static char *extradata2psets(AVCodecContext *c) } psets = av_mallocz(MAX_PSET_SIZE); - if (psets == NULL) { + if (!psets) { av_log(c, AV_LOG_ERROR, "Cannot allocate memory for the parameter sets.\n"); av_free(orig_extradata); return NULL; @@ -216,7 +216,7 @@ static char *extradata2psets(AVCodecContext *c) sps = r; sps_end = r1; } - if (av_base64_encode(p, MAX_PSET_SIZE - (p - psets), r, r1 - r) == NULL) { + if (!av_base64_encode(p, MAX_PSET_SIZE - (p - psets), r, r1 - r)) { av_log(c, AV_LOG_ERROR, "Cannot Base64-encode %td %td!\n", MAX_PSET_SIZE - (p - psets), r1 - r); av_free(psets); @@ -250,7 +250,7 @@ static char *extradata2config(AVCodecContext *c) return NULL; } config = av_malloc(10 + c->extradata_size * 2); - if (config == NULL) { + if (!config) { av_log(c, AV_LOG_ERROR, "Cannot allocate memory for the config info.\n"); return NULL; } @@ -457,7 +457,7 @@ static char *sdp_write_media_attributes(char *buff, int size, AVCodecContext *c, av_log(c, AV_LOG_ERROR, "AAC with no global headers is currently not supported.\n"); return NULL; } - if (config == NULL) { + if (!config) { return NULL; } av_strlcatf(buff, size, "a=rtpmap:%d MPEG4-GENERIC/%d/%d\r\n" diff --git a/libavutil/eval.c b/libavutil/eval.c index 72f976ca4b..31e9ebbc9c 100644 --- a/libavutil/eval.c +++ b/libavutil/eval.c @@ -231,7 +231,7 @@ static int parse_primary(AVExpr **e, Parser *p) } p->s= strchr(p->s, '('); - if (p->s==NULL) { + if (!p->s) { av_log(p, AV_LOG_ERROR, "Undefined constant or missing '(' in '%s'\n", s0); p->s= next; av_expr_free(d); diff --git a/libavutil/internal.h b/libavutil/internal.h index 067c6ca303..aed9925e7c 100644 --- a/libavutil/internal.h +++ b/libavutil/internal.h @@ -117,7 +117,7 @@ #define FF_ALLOC_OR_GOTO(ctx, p, size, label)\ {\ p = av_malloc(size);\ - if (p == NULL && (size) != 0) {\ + if (!(p) && (size) != 0) {\ av_log(ctx, AV_LOG_ERROR, "Cannot allocate memory.\n");\ goto label;\ }\ @@ -126,7 +126,7 @@ #define FF_ALLOCZ_OR_GOTO(ctx, p, size, label)\ {\ p = av_mallocz(size);\ - if (p == NULL && (size) != 0) {\ + if (!(p) && (size) != 0) {\ av_log(ctx, AV_LOG_ERROR, "Cannot allocate memory.\n");\ goto label;\ }\