/soc/2013/ankitkv/gobjectification: fa4166ea1007: Removed value....
Ankit Vani
a at nevitus.org
Sun Jul 14 12:46:38 EDT 2013
Changeset: fa4166ea1007801f9192233679e236997c073204
Author: Ankit Vani <a at nevitus.org>
Date: 2013-07-14 22:16 +0530
Branch: soc.2013.gobjectification
URL: https://hg.pidgin.im/soc/2013/ankitkv/gobjectification/rev/fa4166ea1007
Description:
Removed value.[ch]
diffstat:
libpurple/Makefile.am | 2 -
libpurple/Makefile.mingw | 1 -
libpurple/value.c | 526 -----------------------------------------------
libpurple/value.h | 467 -----------------------------------------
4 files changed, 0 insertions(+), 996 deletions(-)
diffs (truncated from 1033 to 300 lines):
diff --git a/libpurple/Makefile.am b/libpurple/Makefile.am
--- a/libpurple/Makefile.am
+++ b/libpurple/Makefile.am
@@ -101,7 +101,6 @@ purple_coresources = \
theme-manager.c \
upnp.c \
util.c \
- value.c \
version.c \
xmlnode.c \
whiteboard.c
@@ -172,7 +171,6 @@ purple_coreheaders = \
theme-manager.h \
upnp.h \
util.h \
- value.h \
xmlnode.h \
whiteboard.h
diff --git a/libpurple/Makefile.mingw b/libpurple/Makefile.mingw
--- a/libpurple/Makefile.mingw
+++ b/libpurple/Makefile.mingw
@@ -127,7 +127,6 @@ C_SRC = \
theme.c \
upnp.c \
util.c \
- value.c \
version.c \
whiteboard.c \
xmlnode.c \
diff --git a/libpurple/value.c b/libpurple/value.c
deleted file mode 100644
--- a/libpurple/value.c
+++ /dev/null
@@ -1,526 +0,0 @@
-/**
- * @file value.c Value wrapper API
- * @ingroup core
- */
-
-/* purple
- *
- * Purple is the legal property of its developers, whose names are too numerous
- * to list here. Please refer to the COPYRIGHT file distributed with this
- * source distribution.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
- */
-#include "internal.h"
-
-#include "value.h"
-
-#define OUTGOING_FLAG 0x01
-
-/**
- * A wrapper for a type, subtype, and specific type of value.
- */
-struct _PurpleValue
-{
- PurpleType type;
- unsigned short flags;
-
- union
- {
- char char_data;
- unsigned char uchar_data;
- gboolean boolean_data;
- short short_data;
- unsigned short ushort_data;
- int int_data;
- unsigned int uint_data;
- long long_data;
- unsigned long ulong_data;
- gint64 int64_data;
- guint64 uint64_data;
- char *string_data;
- void *object_data;
- void *pointer_data;
- int enum_data;
- void *boxed_data;
-
- } data;
-
- union
- {
- unsigned int subtype;
- char *specific_type;
-
- } u;
-
-};
-
-PurpleValue *
-purple_value_new(PurpleType type, ...)
-{
- PurpleValue *value;
- va_list args;
-
- g_return_val_if_fail(type != PURPLE_TYPE_UNKNOWN, NULL);
-
- value = g_new0(PurpleValue, 1);
-
- value->type = type;
-
- va_start(args, type);
-
- if (type == PURPLE_TYPE_SUBTYPE)
- value->u.subtype = va_arg(args, int);
- else if (type == PURPLE_TYPE_BOXED)
- value->u.specific_type = g_strdup(va_arg(args, char *));
-
- va_end(args);
-
- return value;
-}
-
-PurpleValue *
-purple_value_new_outgoing(PurpleType type, ...)
-{
- PurpleValue *value;
- va_list args;
-
- g_return_val_if_fail(type != PURPLE_TYPE_UNKNOWN, NULL);
-
- value = g_new0(PurpleValue, 1);
-
- value->type = type;
-
- va_start(args, type);
-
- if (type == PURPLE_TYPE_SUBTYPE)
- value->u.subtype = va_arg(args, int);
- else if (type == PURPLE_TYPE_BOXED)
- value->u.specific_type = g_strdup(va_arg(args, char *));
-
- va_end(args);
-
- value->flags |= OUTGOING_FLAG;
-
- return value;
-}
-
-void
-purple_value_destroy(PurpleValue *value)
-{
- g_return_if_fail(value != NULL);
-
- if (purple_value_get_type(value) == PURPLE_TYPE_BOXED)
- {
- g_free(value->u.specific_type);
- }
- else if (purple_value_get_type(value) == PURPLE_TYPE_STRING)
- {
- g_free(value->data.string_data);
- }
-
- g_free(value);
-}
-
-PurpleValue *
-purple_value_dup(const PurpleValue *value)
-{
- PurpleValue *new_value;
- PurpleType type;
-
- g_return_val_if_fail(value != NULL, NULL);
-
- type = purple_value_get_type(value);
-
- if (type == PURPLE_TYPE_SUBTYPE)
- {
- new_value = purple_value_new(PURPLE_TYPE_SUBTYPE,
- purple_value_get_subtype(value));
- }
- else if (type == PURPLE_TYPE_BOXED)
- {
- new_value = purple_value_new(PURPLE_TYPE_BOXED,
- purple_value_get_specific_type(value));
- }
- else
- new_value = purple_value_new(type);
-
- new_value->flags = value->flags;
-
- switch (type)
- {
- case PURPLE_TYPE_CHAR:
- purple_value_set_char(new_value, purple_value_get_char(value));
- break;
-
- case PURPLE_TYPE_UCHAR:
- purple_value_set_uchar(new_value, purple_value_get_uchar(value));
- break;
-
- case PURPLE_TYPE_BOOLEAN:
- purple_value_set_boolean(new_value, purple_value_get_boolean(value));
- break;
-
- case PURPLE_TYPE_SHORT:
- purple_value_set_short(new_value, purple_value_get_short(value));
- break;
-
- case PURPLE_TYPE_USHORT:
- purple_value_set_ushort(new_value, purple_value_get_ushort(value));
- break;
-
- case PURPLE_TYPE_INT:
- purple_value_set_int(new_value, purple_value_get_int(value));
- break;
-
- case PURPLE_TYPE_UINT:
- purple_value_set_uint(new_value, purple_value_get_uint(value));
- break;
-
- case PURPLE_TYPE_LONG:
- purple_value_set_long(new_value, purple_value_get_long(value));
- break;
-
- case PURPLE_TYPE_ULONG:
- purple_value_set_ulong(new_value, purple_value_get_ulong(value));
- break;
-
- case PURPLE_TYPE_INT64:
- purple_value_set_int64(new_value, purple_value_get_int64(value));
- break;
-
- case PURPLE_TYPE_UINT64:
- purple_value_set_uint64(new_value, purple_value_get_uint64(value));
- break;
-
- case PURPLE_TYPE_STRING:
- purple_value_set_string(new_value, purple_value_get_string(value));
- break;
-
- case PURPLE_TYPE_OBJECT:
- purple_value_set_object(new_value, purple_value_get_object(value));
- break;
-
- case PURPLE_TYPE_POINTER:
- purple_value_set_pointer(new_value, purple_value_get_pointer(value));
- break;
-
- case PURPLE_TYPE_ENUM:
- purple_value_set_enum(new_value, purple_value_get_enum(value));
- break;
-
- case PURPLE_TYPE_BOXED:
- purple_value_set_boxed(new_value, purple_value_get_boxed(value));
- break;
-
- default:
- break;
- }
-
- return new_value;
-}
-
-PurpleType
-purple_value_get_type(const PurpleValue *value)
-{
- g_return_val_if_fail(value != NULL, PURPLE_TYPE_UNKNOWN);
-
- return value->type;
-}
-
-unsigned int
-purple_value_get_subtype(const PurpleValue *value)
-{
- g_return_val_if_fail(value != NULL, 0);
- g_return_val_if_fail(purple_value_get_type(value) == PURPLE_TYPE_SUBTYPE, 0);
-
- return value->u.subtype;
-}
-
-const char *
-purple_value_get_specific_type(const PurpleValue *value)
-{
- g_return_val_if_fail(value != NULL, NULL);
- g_return_val_if_fail(purple_value_get_type(value) == PURPLE_TYPE_BOXED, NULL);
-
- return value->u.specific_type;
-}
-
-gboolean
-purple_value_is_outgoing(const PurpleValue *value)
-{
- g_return_val_if_fail(value != NULL, FALSE);
-
More information about the Commits
mailing list