[gnome-builder] libide: Only use asserts that can be disabled at build
- From: Patrick Griffis <pgriffis src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] libide: Only use asserts that can be disabled at build
- Date: Wed, 6 May 2015 21:44:18 +0000 (UTC)
commit 3850598eab9f2b284818536f0b0fb8a6b1e29f05
Author: Patrick Griffis <tingping tingping se>
Date: Wed May 6 17:40:11 2015 -0400
libide: Only use asserts that can be disabled at build
libide/clang/ide-clang-completion-item.c | 6 +++---
libide/gsettings/ide-language-defaults.c | 6 +++---
libide/ide-context.c | 4 ++--
libide/ide-highlight-index.c | 4 ++--
libide/ide-source-view.c | 16 ++++++++--------
libide/ide-vcs-uri.c | 6 +++---
libide/modelines/modeline-parser.c | 2 +-
7 files changed, 22 insertions(+), 22 deletions(-)
---
diff --git a/libide/clang/ide-clang-completion-item.c b/libide/clang/ide-clang-completion-item.c
index 318fbc1..e2c37a9 100644
--- a/libide/clang/ide-clang-completion-item.c
+++ b/libide/clang/ide-clang-completion-item.c
@@ -552,13 +552,13 @@ ide_clang_completion_item_get_typed_text (IdeClangCompletionItem *self)
enum CXCompletionChunkKind kind;
unsigned num_chunks;
- g_assert_cmpint (self->typed_text_index, >=, 0);
+ g_assert (self->typed_text_index >= 0);
num_chunks = clang_getNumCompletionChunks (result->CompletionString);
- g_assert_cmpint (num_chunks, >, self->typed_text_index);
+ g_assert (num_chunks > self->typed_text_index);
kind = clang_getCompletionChunkKind (result->CompletionString, self->typed_text_index);
- g_assert_cmpint (kind, ==, CXCompletionChunk_TypedText);
+ g_assert (kind == CXCompletionChunk_TypedText);
}
#endif
diff --git a/libide/gsettings/ide-language-defaults.c b/libide/gsettings/ide-language-defaults.c
index ed92973..832f3ba 100644
--- a/libide/gsettings/ide-language-defaults.c
+++ b/libide/gsettings/ide-language-defaults.c
@@ -44,9 +44,9 @@ ide_language_defaults_migrate (GKeyFile *key_file,
gsize i;
g_assert (key_file);
- g_assert_cmpint (current_version, >=, 0);
- g_assert_cmpint (current_version, >=, 0);
- g_assert_cmpint (new_version, >, current_version);
+ g_assert (current_version >= 0);
+ g_assert (current_version >= 0);
+ g_assert (new_version > current_version);
groups = g_key_file_get_groups (key_file, NULL);
diff --git a/libide/ide-context.c b/libide/ide-context.c
index 1060c47..fe56f08 100644
--- a/libide/ide-context.c
+++ b/libide/ide-context.c
@@ -1373,7 +1373,7 @@ ide_context_unload__buffer_manager_save_file_cb (GObject *object,
g_assert (G_IS_TASK (task));
in_progress = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (task), "IN_PROGRESS"));
- g_assert_cmpint (in_progress, >, 0);
+ g_assert (in_progress > 0);
in_progress--;
g_object_set_data (G_OBJECT (task), "IN_PROGRESS", GINT_TO_POINTER (in_progress));
@@ -1632,7 +1632,7 @@ restore_in_idle (gpointer user_data)
}
g_assert (ar != NULL);
- g_assert_cmpint (ar->len, >, 0);
+ g_assert (ar->len > 0);
uf = g_ptr_array_index (ar, ar->len - 1);
file = ide_unsaved_file_get_file (uf);
diff --git a/libide/ide-highlight-index.c b/libide/ide-highlight-index.c
index 6ed2770..359315a 100644
--- a/libide/ide-highlight-index.c
+++ b/libide/ide-highlight-index.c
@@ -101,7 +101,7 @@ IdeHighlightIndex *
ide_highlight_index_ref (IdeHighlightIndex *self)
{
g_assert (self);
- g_assert_cmpint (self->ref_count, >, 0);
+ g_assert (self->ref_count > 0);
g_atomic_int_inc (&self->ref_count);
@@ -124,7 +124,7 @@ void
ide_highlight_index_unref (IdeHighlightIndex *self)
{
g_assert (self);
- g_assert_cmpint (self->ref_count, >, 0);
+ g_assert (self->ref_count > 0);
if (g_atomic_int_dec_and_test (&self->ref_count))
ide_highlight_index_finalize (self);
diff --git a/libide/ide-source-view.c b/libide/ide-source-view.c
index 7616295..2655745 100644
--- a/libide/ide-source-view.c
+++ b/libide/ide-source-view.c
@@ -293,8 +293,8 @@ search_movement_new (IdeSourceView *self,
mv->exclusive = !!exclusive;
mv->count = use_count ? MAX (priv->count, 1) : 1;
- g_assert_cmpint (mv->ref_count, ==, 1);
- g_assert_cmpint (mv->count, >, 0);
+ g_assert (mv->ref_count == 1);
+ g_assert (mv->count > 0);
return mv;
}
@@ -1686,7 +1686,7 @@ ide_source_view_maybe_delete_match (IdeSourceView *self,
g_assert (IDE_IS_SOURCE_VIEW (self));
g_assert (event);
- g_assert_cmpint (event->keyval, ==, GDK_KEY_BackSpace);
+ g_assert (event->keyval == GDK_KEY_BackSpace);
if (!priv->insert_matching_brace)
return FALSE;
@@ -1959,7 +1959,7 @@ ide_source_view_do_smart_backspace (IdeSourceView *self,
gint target_column = visual_column - indent_width;
gunichar ch;
- g_assert_cmpint (target_column, >=, 0);
+ g_assert (target_column >= 0);
while (GET_VISUAL_COLUMN (&insert) > target_column)
{
@@ -6439,10 +6439,10 @@ ide_source_view_scroll_to_iter (IdeSourceView *self,
xalign = (iter_rect.x - visible_rect.x) / (gdouble)visible_rect.width;
}
- g_assert_cmpint (xalign, >=, 0.0);
- g_assert_cmpint (yalign, >=, 0.0);
- g_assert_cmpint (xalign, <=, 1.0);
- g_assert_cmpint (yalign, <=, 1.0);
+ g_assert (xalign >= 0.0);
+ g_assert (yalign >= 0.0);
+ g_assert (xalign <= 1.0);
+ g_assert (yalign <= 1.0);
/* get the screen coordinates within the real visible area */
xoffset = (visible_rect.x - real_visible_rect.x) + (xalign * visible_rect.width);
diff --git a/libide/ide-vcs-uri.c b/libide/ide-vcs-uri.c
index d22b5e4..7833bc4 100644
--- a/libide/ide-vcs-uri.c
+++ b/libide/ide-vcs-uri.c
@@ -74,15 +74,15 @@ ide_vcs_uri_parse (IdeVcsUri *self,
/* http://stackoverflow.com/questions/2514859/regular-expression-for-git-repository */
regex1 = g_regex_new ("file://(.*)", 0, 0, NULL);
- g_assert_no_error (error);
+ g_assert (error == NULL);
g_assert (regex1);
regex2 = g_regex_new ("(\\w+://)(.+@)*([\\w\\d\\.]+)(:[\\d]+){0,1}/*(.*)", 0, 0, NULL);
- g_assert_no_error (error);
+ g_assert (error == NULL);
g_assert (regex2);
regex3 = g_regex_new ("(.+@)*([\\w\\d\\.]+):(.*)", 0, 0, NULL);
- g_assert_no_error (error);
+ g_assert (error == NULL);
g_assert (regex3);
g_once_init_leave (&initialized, TRUE);
diff --git a/libide/modelines/modeline-parser.c b/libide/modelines/modeline-parser.c
index e40c4ff..db8e2e1 100644
--- a/libide/modelines/modeline-parser.c
+++ b/libide/modelines/modeline-parser.c
@@ -138,7 +138,7 @@ load_language_mappings (void)
data = g_bytes_get_data (bytes, &len);
g_assert (data);
- g_assert_cmpint (len, >, 0);
+ g_assert (len > 0);
mappings = g_key_file_new ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]