[nautilus-actions] Accepts null or empty input string or output pointers
- From: Pierre Wieser <pwieser src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus-actions] Accepts null or empty input string or output pointers
- Date: Tue, 17 Aug 2010 20:55:25 +0000 (UTC)
commit 994fc3b9b96c409034cc998376e6fe3de8b43954
Author: Pierre Wieser <pwieser trychlos org>
Date: Tue Aug 17 13:26:57 2010 +0200
Accepts null or empty input string or output pointers
ChangeLog | 3 +++
src/core/na-core-utils.c | 24 ++++++++++++++++++------
2 files changed, 21 insertions(+), 6 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index c7e161a..4f1bf6b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
2010-08-17 Pierre Wieser <pwieser trychlos org>
+ * src/core/na-core-utils.c (na_core_utils_str_split_first_word):
+ Accepts null or empty input string or output pointers.
+
* src/io-desktop/nadp-reader.c (read_done_profile_split_exec):
Only try to split a non-null command.
diff --git a/src/core/na-core-utils.c b/src/core/na-core-utils.c
index 9a748b0..58fb3e5 100644
--- a/src/core/na-core-utils.c
+++ b/src/core/na-core-utils.c
@@ -196,14 +196,26 @@ na_core_utils_str_split_first_word( const gchar *string, gchar **first, gchar **
{
gchar **splitted, **iter;
- splitted = g_strsplit( string, " ", 2 );
- iter = splitted;
+ if( first ){
+ *first = NULL;
+ }
- *first = g_strdup( *iter );
- iter++;
- *other = g_strdup( *iter );
+ if( other ){
+ *other = NULL;
+ }
- g_strfreev( splitted );
+ if( string && g_utf8_strlen( string, -1 )){
+ splitted = g_strsplit( string, " ", 2 );
+ iter = splitted;
+ if( first ){
+ *first = g_strdup( *iter );
+ }
+ iter++;
+ if( other ){
+ *other = g_strdup( *iter );
+ }
+ g_strfreev( splitted );
+ }
}
void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]