summaryrefslogtreecommitdiff
path: root/libavcodec
diff options
context:
space:
mode:
authorGabriel Dume <gabriel.ddx84@gmail.com>2014-08-14 16:31:25 -0400
committerDiego Biurrun <diego@biurrun.de>2014-08-15 05:34:13 -0700
commit4b1f5e5090abed6c618c8ba380cd7d28d140f867 (patch)
treed5281695ec758c21ed6c0df8e3c03433bca28d18 /libavcodec
parentf929ab0569ff31ed5a59b0b0adb7ce09df3fca39 (diff)
cosmetics: Write NULL pointer inequality checks more compactly
Signed-off-by: Diego Biurrun <diego@biurrun.de>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/dvdsubdec.c2
-rw-r--r--libavcodec/h263dec.c2
-rw-r--r--libavcodec/h264_refs.c2
-rw-r--r--libavcodec/libvpxenc.c2
-rw-r--r--libavcodec/libxvid.c4
-rw-r--r--libavcodec/mpeg12dec.c2
-rw-r--r--libavcodec/qdm2.c14
-rw-r--r--libavcodec/rv10.c4
-rw-r--r--libavcodec/rv34.c2
-rw-r--r--libavcodec/utils.c4
-rw-r--r--libavcodec/vc1dec.c2
11 files changed, 20 insertions, 20 deletions
diff --git a/libavcodec/dvdsubdec.c b/libavcodec/dvdsubdec.c
index 856d666b04..5d6db41d35 100644
--- a/libavcodec/dvdsubdec.c
+++ b/libavcodec/dvdsubdec.c
@@ -314,7 +314,7 @@ static int decode_dvd_subtitles(DVDSubContext *ctx, AVSubtitle *sub_header,
if (h < 0)
h = 0;
if (w > 0 && h > 0) {
- 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]);
diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c
index e7ce56c699..cfb77b078f 100644
--- a/libavcodec/h263dec.c
+++ b/libavcodec/h263dec.c
@@ -625,7 +625,7 @@ intrax8_decoded:
if ((ret = av_frame_ref(pict, s->current_picture_ptr->f)) < 0)
return ret;
ff_print_debug_info(s, s->current_picture_ptr);
- } else if (s->last_picture_ptr != NULL) {
+ } else if (s->last_picture_ptr) {
if ((ret = av_frame_ref(pict, s->last_picture_ptr->f)) < 0)
return ret;
ff_print_debug_info(s, s->last_picture_ptr);
diff --git a/libavcodec/h264_refs.c b/libavcodec/h264_refs.c
index af7fa7b523..03c1b9c6c3 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 ]) {
+ !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/libvpxenc.c b/libavcodec/libvpxenc.c
index 99f8b3e312..2c438951c6 100644
--- a/libavcodec/libvpxenc.c
+++ b/libavcodec/libvpxenc.c
@@ -159,7 +159,7 @@ static void coded_frame_add(void *list, struct FrameListData *cx_frame)
{
struct FrameListData **p = list;
- while (*p != NULL)
+ while (*p)
p = &(*p)->next;
*p = cx_frame;
cx_frame->next = NULL;
diff --git a/libavcodec/libxvid.c b/libavcodec/libxvid.c
index f4935b836f..ad650dd840 100644
--- a/libavcodec/libxvid.c
+++ b/libavcodec/libxvid.c
@@ -127,7 +127,7 @@ static int xvid_ff_2pass_destroy(struct xvid_context *ref,
xvid_plg_destroy_t *param) {
/* Currently cannot think of anything to do on destruction */
/* Still, the framework should be here for reference/use */
- if( ref->twopassbuffer != NULL )
+ if (ref->twopassbuffer)
ref->twopassbuffer[0] = 0;
return 0;
}
@@ -772,7 +772,7 @@ static av_cold int xvid_encode_close(AVCodecContext *avctx) {
xvid_encore(x->encoder_handle, XVID_ENC_DESTROY, NULL, NULL);
av_freep(&avctx->extradata);
- if( x->twopassbuffer != NULL ) {
+ if (x->twopassbuffer) {
av_free(x->twopassbuffer);
av_free(x->old_twopassbuffer);
}
diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c
index 2b86ea87fe..e3bd1675a8 100644
--- a/libavcodec/mpeg12dec.c
+++ b/libavcodec/mpeg12dec.c
@@ -2028,7 +2028,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
s->picture_number++;
/* latency of 1 frame for I- and P-frames */
/* XXX: use another variable than picture_number */
- if (s->last_picture_ptr != NULL) {
+ if (s->last_picture_ptr) {
int ret = av_frame_ref(pict, s->last_picture_ptr->f);
if (ret < 0)
return ret;
diff --git a/libavcodec/qdm2.c b/libavcodec/qdm2.c
index 3041182e25..94bda9169a 100644
--- a/libavcodec/qdm2.c
+++ b/libavcodec/qdm2.c
@@ -455,7 +455,7 @@ static void qdm2_decode_sub_packet_header(GetBitContext *gb,
static QDM2SubPNode *qdm2_search_subpacket_type_in_list(QDM2SubPNode *list,
int type)
{
- while (list != NULL && list->packet != NULL) {
+ while (list && list->packet) {
if (list->packet->type == type)
return list;
list = list->next;
@@ -1211,23 +1211,23 @@ static void process_synthesis_subpackets(QDM2Context *q, QDM2SubPNode *list)
QDM2SubPNode *nodes[4];
nodes[0] = qdm2_search_subpacket_type_in_list(list, 9);
- if (nodes[0] != NULL)
+ if (nodes[0])
process_subpacket_9(q, nodes[0]);
nodes[1] = qdm2_search_subpacket_type_in_list(list, 10);
- if (nodes[1] != NULL)
+ if (nodes[1])
process_subpacket_10(q, nodes[1]);
else
process_subpacket_10(q, NULL);
nodes[2] = qdm2_search_subpacket_type_in_list(list, 11);
- if (nodes[0] != NULL && nodes[1] != NULL && nodes[2] != NULL)
+ if (nodes[0] && nodes[1] && nodes[2])
process_subpacket_11(q, nodes[2]);
else
process_subpacket_11(q, NULL);
nodes[3] = qdm2_search_subpacket_type_in_list(list, 12);
- if (nodes[0] != NULL && nodes[1] != NULL && nodes[3] != NULL)
+ if (nodes[0] && nodes[1] && nodes[3])
process_subpacket_12(q, nodes[3]);
else
process_subpacket_12(q, NULL);
@@ -1352,7 +1352,7 @@ static void qdm2_decode_super_block(QDM2Context *q)
}
} // Packet bytes loop
- if (q->sub_packet_list_D[0].packet != NULL) {
+ if (q->sub_packet_list_D[0].packet) {
process_synthesis_subpackets(q, q->sub_packet_list_D);
q->do_synth_filter = 1;
} else if (q->do_synth_filter) {
@@ -1939,7 +1939,7 @@ static int qdm2_decode(QDM2Context *q, const uint8_t *in, int16_t *out)
for (ch = 0; ch < q->channels; ch++) {
qdm2_calculate_fft(q, ch, q->sub_packet);
- if (!q->has_errors && q->sub_packet_list_C[0].packet != NULL) {
+ if (!q->has_errors && q->sub_packet_list_C[0].packet) {
SAMPLES_NEEDED_2("has errors, and C list is not empty")
return -1;
}
diff --git a/libavcodec/rv10.c b/libavcodec/rv10.c
index 2b571c9ba2..e5b76f08ca 100644
--- a/libavcodec/rv10.c
+++ b/libavcodec/rv10.c
@@ -737,7 +737,7 @@ static int rv10_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
i++;
}
- if (s->current_picture_ptr != NULL && s->mb_y >= s->mb_height) {
+ if (s->current_picture_ptr && s->mb_y >= s->mb_height) {
ff_er_frame_end(&s->er);
ff_mpv_frame_end(s);
@@ -745,7 +745,7 @@ static int rv10_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
if ((ret = av_frame_ref(pict, s->current_picture_ptr->f)) < 0)
return ret;
ff_print_debug_info(s, s->current_picture_ptr);
- } else if (s->last_picture_ptr != NULL) {
+ } else if (s->last_picture_ptr) {
if ((ret = av_frame_ref(pict, s->last_picture_ptr->f)) < 0)
return ret;
ff_print_debug_info(s, s->last_picture_ptr);
diff --git a/libavcodec/rv34.c b/libavcodec/rv34.c
index 75f321a430..4ed2a33b11 100644
--- a/libavcodec/rv34.c
+++ b/libavcodec/rv34.c
@@ -1591,7 +1591,7 @@ static int finish_frame(AVCodecContext *avctx, AVFrame *pict)
return ret;
ff_print_debug_info(s, s->current_picture_ptr);
got_picture = 1;
- } else if (s->last_picture_ptr != NULL) {
+ } else if (s->last_picture_ptr) {
if ((ret = av_frame_ref(pict, s->last_picture_ptr->f)) < 0)
return ret;
ff_print_debug_info(s, s->last_picture_ptr);
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 7e116ed9e2..afc0396375 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -107,7 +107,7 @@ av_cold void avcodec_register(AVCodec *codec)
AVCodec **p;
avcodec_init();
p = &first_avcodec;
- while (*p != NULL)
+ while (*p)
p = &(*p)->next;
*p = codec;
codec->next = NULL;
@@ -473,7 +473,7 @@ static int video_get_buffer(AVCodecContext *s, AVFrame *pic)
FramePool *pool = s->internal->pool;
int i;
- if (pic->data[0] != NULL) {
+ if (pic->data[0]) {
av_log(s, AV_LOG_ERROR, "pic->data[0]!=NULL in avcodec_default_get_buffer\n");
return -1;
}
diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c
index 2c7db0be1c..f0ea47134b 100644
--- a/libavcodec/vc1dec.c
+++ b/libavcodec/vc1dec.c
@@ -6114,7 +6114,7 @@ image:
goto err;
ff_print_debug_info(s, s->current_picture_ptr);
*got_frame = 1;
- } else if (s->last_picture_ptr != NULL) {
+ } else if (s->last_picture_ptr) {
if ((ret = av_frame_ref(pict, s->last_picture_ptr->f)) < 0)
goto err;
ff_print_debug_info(s, s->last_picture_ptr);