diff options
author | Stef Walter <stefw@collabora.co.uk> | 2011-10-06 12:51:08 +0200 |
---|---|---|
committer | Stef Walter <stefw@collabora.co.uk> | 2011-10-06 13:22:43 +0200 |
commit | f28d3d768f0e4057f727e8c3b93ba50c19f5db24 (patch) | |
tree | 288ef581590dfccbfddcad3c87d98ce3a4ed0a97 /gcr/gcr-util.c | |
parent | 626eef363c0ece57713c5be5939677784e8115cc (diff) | |
download | gnome-keyring-split.tar.gz |
Split Gcr and Gck libraries out of gnome-keyringsplit
Diffstat (limited to 'gcr/gcr-util.c')
-rw-r--r-- | gcr/gcr-util.c | 66 |
1 files changed, 0 insertions, 66 deletions
diff --git a/gcr/gcr-util.c b/gcr/gcr-util.c deleted file mode 100644 index 418b73cb..00000000 --- a/gcr/gcr-util.c +++ /dev/null @@ -1,66 +0,0 @@ -/* - * gnome-keyring - * - * Copyright (C) 2011 Collabora Ltd - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - * - * Author: Stef Walter <stefw@collabora.co.uk> - */ - -#include "config.h" - -#include "gcr-util.h" - -#include <string.h> - -/** - * _gcr_util_parse_lines: - * @string: The string to parse lines from, will be modified - * @last_line: Whether or not we should run for last line or not - * @callback: Call for each line - * @user_data: Data for callback - * - * Calls callback for each line. If last_line, also sends the remainder - * data that comes after the last line break. \n and \r\n are line separators. - * Neither are included in data passed to callback. - */ -void -_gcr_util_parse_lines (GString *string, gboolean last_line, - GcrLineCallback callback, gpointer user_data) -{ - gchar *ptr; - gchar *prev; - - g_return_if_fail (string); - g_return_if_fail (callback); - - /* Print all stderr lines as messages */ - while ((ptr = strchr (string->str, '\n')) != NULL) { - *ptr = '\0'; - prev = ptr - 1; - if (*prev == '\r') - *prev = '\0'; - - (callback) (string->str, user_data); - g_string_erase (string, 0, ptr - string->str + 1); - } - - if (last_line && string->len) { - (callback) (string->str, user_data); - g_string_erase (string, 0, string->len); - } -} |