Revert "micro-optim: if (x) is cheaper than if (x > 0) for unsigned integers"

This reverts commit 6aa8ca37ee.

See http://article.gmane.org/gmane.comp.video.gstreamer.devel/32282
This commit is contained in:
Tim-Philipp Müller 2010-12-26 21:20:31 +00:00
parent 3889c3c579
commit 8a7fc1d8c9
13 changed files with 37 additions and 37 deletions

View file

@ -577,7 +577,7 @@ gst_buffer_create_sub (GstBuffer * buffer, guint offset, guint size)
gboolean complete;
g_return_val_if_fail (buffer != NULL, NULL);
g_return_val_if_fail (buffer->mini_object.refcount, NULL);
g_return_val_if_fail (buffer->mini_object.refcount > 0, NULL);
g_return_val_if_fail (buffer->size >= offset + size, NULL);
/* find real parent */
@ -657,8 +657,8 @@ gboolean
gst_buffer_is_span_fast (GstBuffer * buf1, GstBuffer * buf2)
{
g_return_val_if_fail (buf1 != NULL && buf2 != NULL, FALSE);
g_return_val_if_fail (buf1->mini_object.refcount, FALSE);
g_return_val_if_fail (buf2->mini_object.refcount, FALSE);
g_return_val_if_fail (buf1->mini_object.refcount > 0, FALSE);
g_return_val_if_fail (buf2->mini_object.refcount > 0, FALSE);
/* it's only fast if we have subbuffers of the same parent */
return (GST_IS_SUBBUFFER (buf1) &&
@ -696,9 +696,9 @@ gst_buffer_span (GstBuffer * buf1, guint32 offset, GstBuffer * buf2,
GstBuffer *newbuf;
g_return_val_if_fail (buf1 != NULL && buf2 != NULL, NULL);
g_return_val_if_fail (buf1->mini_object.refcount, NULL);
g_return_val_if_fail (buf2->mini_object.refcount, NULL);
g_return_val_if_fail (len, NULL);
g_return_val_if_fail (buf1->mini_object.refcount > 0, NULL);
g_return_val_if_fail (buf2->mini_object.refcount > 0, NULL);
g_return_val_if_fail (len > 0, NULL);
g_return_val_if_fail (len <= buf1->size + buf2->size - offset, NULL);
/* if the two buffers have the same parent and are adjacent */

View file

@ -313,7 +313,7 @@ gst_bus_post (GstBus * bus, GstMessage * message)
handler = bus->sync_handler;
handler_data = bus->sync_handler_data;
emit_sync_message = bus->priv->num_sync_message_emitters;
emit_sync_message = bus->priv->num_sync_message_emitters > 0;
GST_OBJECT_UNLOCK (bus);
/* first call the sync handler if it is installed */
@ -1216,7 +1216,7 @@ gst_bus_add_signal_watch_full (GstBus * bus, gint priority)
/* I know the callees don't take this lock, so go ahead and abuse it */
GST_OBJECT_LOCK (bus);
if (bus->num_signal_watchers)
if (bus->num_signal_watchers > 0)
goto done;
/* this should not fail because the counter above takes care of it */
@ -1289,7 +1289,7 @@ gst_bus_remove_signal_watch (GstBus * bus)
bus->num_signal_watchers--;
if (bus->num_signal_watchers)
if (bus->num_signal_watchers > 0)
goto done;
id = bus->signal_watch_id;

View file

@ -405,7 +405,7 @@ gst_caps_ref (GstCaps * caps)
GST_CAT_TRACE (GST_CAT_REFCOUNTING, "%p %d->%d", caps,
GST_CAPS_REFCOUNT_VALUE (caps), GST_CAPS_REFCOUNT_VALUE (caps) + 1);
#endif
g_return_val_if_fail (GST_CAPS_REFCOUNT_VALUE (caps), NULL);
g_return_val_if_fail (GST_CAPS_REFCOUNT_VALUE (caps) > 0, NULL);
g_atomic_int_inc (&caps->refcount);
@ -429,7 +429,7 @@ gst_caps_unref (GstCaps * caps)
GST_CAPS_REFCOUNT_VALUE (caps), GST_CAPS_REFCOUNT_VALUE (caps) - 1);
#endif
g_return_if_fail (GST_CAPS_REFCOUNT_VALUE (caps));
g_return_if_fail (GST_CAPS_REFCOUNT_VALUE (caps) > 0);
/* if we ended up with the refcount at zero, free the caps */
if (G_UNLIKELY (g_atomic_int_dec_and_test (&caps->refcount)))
@ -474,7 +474,7 @@ gst_static_caps_get (GstStaticCaps * static_caps)
G_LOCK (static_caps_lock);
/* check if other thread already updated */
if (G_UNLIKELY (g_atomic_int_get (&caps->refcount)))
if (G_UNLIKELY (g_atomic_int_get (&caps->refcount) > 0))
goto done;
string = static_caps->string;
@ -1593,7 +1593,7 @@ gst_caps_subtract (const GstCaps * minuend, const GstCaps * subtrahend)
Note: there's a test that checks this behaviour. */
g_return_val_if_fail (!CAPS_IS_ANY (minuend), NULL);
sublen = subtrahend->structs->len;
g_assert (sublen);
g_assert (sublen > 0);
src = gst_caps_copy (minuend);
for (i = 0; i < sublen; i++) {
@ -2089,7 +2089,7 @@ gst_caps_to_string (const GstCaps * caps)
for (i = 0; i < clen; i++) {
GstStructure *structure;
if (i) {
if (i > 0) {
/* ';' is now added by gst_structure_to_string */
g_string_append_c (s, ' ');
}

View file

@ -1015,7 +1015,7 @@ gst_clock_set_calibration (GstClock * clock, GstClockTime internal, GstClockTime
{
g_return_if_fail (GST_IS_CLOCK (clock));
g_return_if_fail (rate_num != GST_CLOCK_TIME_NONE);
g_return_if_fail (rate_denom && rate_denom != GST_CLOCK_TIME_NONE);
g_return_if_fail (rate_denom > 0 && rate_denom != GST_CLOCK_TIME_NONE);
write_seqlock (clock);
GST_CAT_DEBUG_OBJECT (GST_CAT_CLOCK, clock,

View file

@ -358,7 +358,7 @@ void
gst_mini_object_unref (GstMiniObject * mini_object)
{
g_return_if_fail (GST_IS_MINI_OBJECT (mini_object));
g_return_if_fail (mini_object->refcount);
g_return_if_fail (mini_object->refcount > 0);
GST_CAT_TRACE (GST_CAT_REFCOUNTING, "%p unref %d->%d",
mini_object,

View file

@ -329,7 +329,7 @@ void
gst_object_unref (gpointer object)
{
g_return_if_fail (object != NULL);
g_return_if_fail (((GObject *) object)->ref_count);
g_return_if_fail (((GObject *) object)->ref_count > 0);
#ifdef DEBUG_REFCOUNT
GST_CAT_TRACE_OBJECT (GST_CAT_REFCOUNTING, object, "%p unref %d->%d", object,

View file

@ -4185,7 +4185,7 @@ gst_pad_chain_data_unchecked (GstPad * pad, gboolean is_buffer, void *data,
caps = gst_pad_data_get_caps (is_buffer, data);
caps_changed = caps && caps != GST_PAD_CAPS (pad);
emit_signal = GST_PAD_DO_BUFFER_SIGNALS (pad) != 0;
emit_signal = GST_PAD_DO_BUFFER_SIGNALS (pad) > 0;
GST_OBJECT_UNLOCK (pad);
/* see if the signal should be emited, we emit before caps nego as
@ -4422,7 +4422,7 @@ gst_pad_push_data (GstPad * pad, gboolean is_buffer, void *data,
/* we emit signals on the pad arg, the peer will have a chance to
* emit in the _chain() function */
if (G_UNLIKELY (GST_PAD_DO_BUFFER_SIGNALS (pad))) {
if (G_UNLIKELY (GST_PAD_DO_BUFFER_SIGNALS (pad) > 0)) {
cache = NULL;
/* unlock before emitting */
GST_OBJECT_UNLOCK (pad);
@ -4889,7 +4889,7 @@ gst_pad_get_range_unchecked (GstPad * pad, guint64 offset, guint size,
if (G_UNLIKELY (GST_PAD_IS_FLUSHING (pad)))
goto flushing;
emit_signal = GST_PAD_DO_BUFFER_SIGNALS (pad) != 0;
emit_signal = GST_PAD_DO_BUFFER_SIGNALS (pad) > 0;
GST_OBJECT_UNLOCK (pad);
if (G_UNLIKELY ((getrangefunc = GST_PAD_GETRANGEFUNC (pad)) == NULL))
@ -5059,7 +5059,7 @@ gst_pad_pull_range (GstPad * pad, guint64 offset, guint size,
/* signal emision for the pad, peer has chance to emit when
* we call _get_range() */
emit_signal = GST_PAD_DO_BUFFER_SIGNALS (pad) != 0;
emit_signal = GST_PAD_DO_BUFFER_SIGNALS (pad) > 0;
gst_object_ref (peer);
GST_OBJECT_UNLOCK (pad);
@ -5197,7 +5197,7 @@ gst_pad_push_event (GstPad * pad, GstEvent * event)
GST_EVENT_SRC (event) = gst_object_ref (pad);
}
if (G_UNLIKELY (GST_PAD_DO_EVENT_SIGNALS (pad) != 0)) {
if (G_UNLIKELY (GST_PAD_DO_EVENT_SIGNALS (pad) > 0)) {
GST_OBJECT_UNLOCK (pad);
if (!gst_pad_emit_have_data_signal (pad, GST_MINI_OBJECT (event)))
@ -5304,7 +5304,7 @@ gst_pad_send_event (GstPad * pad, GstEvent * event)
}
/* pad signals */
if (G_UNLIKELY (GST_PAD_DO_EVENT_SIGNALS (pad) != 0)) {
if (G_UNLIKELY (GST_PAD_DO_EVENT_SIGNALS (pad) > 0)) {
GST_OBJECT_UNLOCK (pad);
if (!gst_pad_emit_have_data_signal (pad, GST_MINI_OBJECT_CAST (event)))

View file

@ -1129,7 +1129,7 @@ gst_registry_scan_path_level (GstRegistryScanContext * context,
/* FIXME 0.11: Don't recurse into directories, this behaviour
* is inconsistent with other PATH environment variables
*/
if (level) {
if (level > 0) {
GST_LOG_OBJECT (context->registry, "recursing into directory %s",
filename);
changed |= gst_registry_scan_path_level (context, filename, level - 1);

View file

@ -1756,7 +1756,7 @@ gst_structure_value_get_generic_type (GValue * val)
|| G_VALUE_TYPE (val) == GST_TYPE_ARRAY) {
GArray *array = g_value_peek_pointer (val);
if (array->len) {
if (array->len > 0) {
GValue *value = &g_array_index (array, GValue, 0);
return gst_structure_value_get_generic_type (value);

View file

@ -339,7 +339,7 @@ gst_system_clock_add_wakeup (GstSystemClock * sysclock)
static void
gst_system_clock_wait_wakeup (GstSystemClock * sysclock)
{
while (sysclock->priv->wakeup_count) {
while (sysclock->priv->wakeup_count > 0) {
GST_CLOCK_WAIT (sysclock);
}
}

View file

@ -1172,7 +1172,7 @@ gst_tag_list_get_value_index (const GstTagList * list, const gchar * tag,
return NULL;
return gst_value_list_get_value (value, index);
} else {
if (index)
if (index > 0)
return NULL;
return value;
}

View file

@ -307,7 +307,7 @@ gst_util_div128_64 (GstUInt64 c1, GstUInt64 c0, guint64 denom)
* part of denom since denom > G_MAXUINT32. */
s = gst_util_clz (v.l.high);
if (s) {
if (s > 0) {
/* normalize divisor and dividend */
v.ll <<= s;
c1.ll = (c1.ll << s) | (c0.l.high >> (32 - s));
@ -3362,7 +3362,7 @@ void
gst_pad_remove_data_probe (GstPad * pad, guint handler_id)
{
g_return_if_fail (GST_IS_PAD (pad));
g_return_if_fail (handler_id);
g_return_if_fail (handler_id > 0);
GST_OBJECT_LOCK (pad);
g_signal_handler_disconnect (pad, handler_id);
@ -3386,7 +3386,7 @@ void
gst_pad_remove_event_probe (GstPad * pad, guint handler_id)
{
g_return_if_fail (GST_IS_PAD (pad));
g_return_if_fail (handler_id);
g_return_if_fail (handler_id > 0);
GST_OBJECT_LOCK (pad);
g_signal_handler_disconnect (pad, handler_id);
@ -3408,7 +3408,7 @@ void
gst_pad_remove_buffer_probe (GstPad * pad, guint handler_id)
{
g_return_if_fail (GST_IS_PAD (pad));
g_return_if_fail (handler_id);
g_return_if_fail (handler_id > 0);
GST_OBJECT_LOCK (pad);
g_signal_handler_disconnect (pad, handler_id);

View file

@ -891,7 +891,7 @@ gst_queue_is_empty (GstQueue * queue)
* Therefore, only consider it empty if it is not filled. */
return ((queue->min_threshold.buffers > 0 &&
queue->cur_level.buffers < queue->min_threshold.buffers) ||
(queue->min_threshold.bytes &&
(queue->min_threshold.bytes > 0 &&
queue->cur_level.bytes < queue->min_threshold.bytes) ||
(queue->min_threshold.time > 0 &&
queue->cur_level.time < queue->min_threshold.time)) &&
@ -901,11 +901,11 @@ gst_queue_is_empty (GstQueue * queue)
static gboolean
gst_queue_is_filled (GstQueue * queue)
{
return (((queue->max_size.buffers &&
return (((queue->max_size.buffers > 0 &&
queue->cur_level.buffers >= queue->max_size.buffers) ||
(queue->max_size.bytes &&
(queue->max_size.bytes > 0 &&
queue->cur_level.bytes >= queue->max_size.bytes) ||
(queue->max_size.time &&
(queue->max_size.time > 0 &&
queue->cur_level.time >= queue->max_size.time)));
}
@ -1344,13 +1344,13 @@ gst_queue_handle_src_query (GstPad * pad, GstQuery * query)
* limit, the best thing we can do is to return an infinite delay. In
* reality a better estimate would be the byte/buffer rate but that is not
* possible right now. */
if (queue->max_size.time && max != -1)
if (queue->max_size.time > 0 && max != -1)
max += queue->max_size.time;
else
max = -1;
/* adjust for min-threshold */
if (queue->min_threshold.time && min != -1)
if (queue->min_threshold.time > 0 && min != -1)
min += queue->min_threshold.time;
gst_query_set_latency (query, live, min, max);