[vte] Remove unused code
- From: Behdad Esfahbod <behdad src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [vte] Remove unused code
- Date: Thu, 20 Aug 2009 19:12:47 +0000 (UTC)
commit ee6fd1c3d8c2ba19c63565a0c889bbdc10125596
Author: Behdad Esfahbod <behdad behdad org>
Date: Thu Aug 20 14:55:41 2009 -0400
Remove unused code
src/Makefile.am | 7 +-
src/buffer.c | 247 -------------------------------------------------------
src/buffer.h | 23 -----
3 files changed, 2 insertions(+), 275 deletions(-)
---
diff --git a/src/Makefile.am b/src/Makefile.am
index cc6e7c9..97a0ca6 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -159,8 +159,8 @@ EXTRA_DIST += $(pkglib_SCRIPTS)
TEST_SH = check-doc-syntax.sh
EXTRA_DIST += $(TEST_SH)
-check_PROGRAMS = buffer dumpkeys iso2022 pty reaper reflect-text-view reflect-vte ring mev ssfe table trie xticker vteconv vtetc
-TESTS = buffer ring table trie $(TEST_SH)
+check_PROGRAMS = dumpkeys iso2022 pty reaper reflect-text-view reflect-vte ring mev ssfe table trie xticker vteconv vtetc
+TESTS = ring table trie $(TEST_SH)
AM_CFLAGS = $(GLIB_CFLAGS) $(GOBJECT_CFLAGS)
LDADD = $(GLIB_LIBS) $(GOBJECT_LIBS)
@@ -290,9 +290,6 @@ vteconv_CPPFLAGS = -DVTECONV_MAIN
vteconv_CFLAGS = $(VTE_CFLAGS)
vteconv_LDADD = $(VTE_LIBS)
-buffer_SOURCES = buffer.c
-buffer_CPPFLAGS = -DBUFFER_MAIN
-
dumpkeys_SOURCES = dumpkeys.c
mev_SOURCES = mev.c
ssfe_SOURCES = ssfe.c
diff --git a/src/buffer.c b/src/buffer.c
index ed16bfe..ed47743 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -64,15 +64,6 @@ _vte_buffer_new(void)
return (struct _vte_buffer*) buf;
}
-struct _vte_buffer*
-_vte_buffer_new_with_data(gconstpointer data, size_t length)
-{
- struct _vte_buffer *buf;
- buf = _vte_buffer_new();
- _vte_buffer_append(buf, data, length);
- return buf;
-}
-
void
_vte_buffer_set_minimum_size(struct _vte_buffer *buffer, size_t length)
{
@@ -98,34 +89,6 @@ _vte_buffer_set_minimum_size(struct _vte_buffer *buffer, size_t length)
}
void
-_vte_buffer_prepend(struct _vte_buffer *buffer,
- gconstpointer bytes, size_t length)
-{
- struct _vte_real_buffer *buf = (struct _vte_real_buffer*) buffer;
- size_t size;
- unsigned char *tmp;
- _vte_buffer_check(buffer, 0);
- if (length > 0) {
- if (buf->buf_used + length > buf->buf_length) {
- size = _vte_buffer_calc_new_size(buf->buf_used +
- length);
- tmp = g_malloc(size);
- if (buf->bytes != NULL) {
- if (buf->buf_used > 0) {
- memcpy(tmp, buf->bytes, buf->buf_used);
- }
- g_free(buf->bytes);
- }
- buf->bytes = tmp;
- buf->buf_length = size;
- }
- memmove(buf->bytes + length, buf->bytes, buf->buf_used);
- memcpy(buf->bytes, bytes, length);
- buf->buf_used += length;
- }
-}
-
-void
_vte_buffer_append(struct _vte_buffer *buffer,
gconstpointer bytes, size_t length)
{
@@ -191,213 +154,3 @@ _vte_buffer_length(struct _vte_buffer *buffer)
_vte_buffer_check(buffer, 0);
return buf->buf_used;
}
-
-void
-_vte_buffer_append_guint16(struct _vte_buffer *buffer, guint16 i)
-{
- guint16 j;
- j = g_htons(i);
- _vte_buffer_append(buffer, (gpointer) &j, sizeof(j));
-}
-
-guint16
-_vte_buffer_peek_guint16(struct _vte_buffer *buffer)
-{
- guint16 i;
- _vte_buffer_check(buffer, sizeof(i));
- memcpy(&i, buffer->bytes, sizeof(i));
- return g_ntohs(i);
-}
-
-guint16
-_vte_buffer_read_guint16(struct _vte_buffer *buffer)
-{
- guint16 ret;
- ret = _vte_buffer_peek_guint16(buffer);
- _vte_buffer_consume(buffer, sizeof(ret));
- return ret;
-}
-
-void
-_vte_buffer_append_guint32(struct _vte_buffer *buffer, guint32 i)
-{
- guint32 j;
- j = g_htonl(i);
- _vte_buffer_append(buffer, (gpointer) &j, sizeof(j));
-}
-
-guint32
-_vte_buffer_peek_guint32(struct _vte_buffer *buffer)
-{
- guint32 i;
- _vte_buffer_check(buffer, sizeof(i));
- memcpy(&i, buffer->bytes, sizeof(i));
- return g_ntohl(i);
-}
-
-guint32
-_vte_buffer_read_guint32(struct _vte_buffer *buffer)
-{
- guint32 ret;
- ret = _vte_buffer_peek_guint32(buffer);
- _vte_buffer_consume(buffer, sizeof(ret));
- return ret;
-}
-
-void
-_vte_buffer_append_gstring(struct _vte_buffer *buffer, const GString *s)
-{
- _vte_buffer_append_guint32(buffer, s->len);
- _vte_buffer_append(buffer, s->str, s->len);
-}
-
-GString *
-_vte_buffer_peek_gstring(struct _vte_buffer *buffer)
-{
- GString *ret;
- guint32 i;
- i = _vte_buffer_peek_guint32(buffer);
- _vte_buffer_check(buffer, sizeof(i) + i);
- ret = g_string_new_len((gchar *)buffer->bytes + sizeof(i), i);
- return ret;
-}
-
-GString *
-_vte_buffer_read_gstring(struct _vte_buffer *buffer)
-{
- GString *ret;
- ret = _vte_buffer_peek_gstring(buffer);
- _vte_buffer_consume(buffer, sizeof(guint32) + ret->len);
- return ret;
-}
-
-void
-_vte_buffer_append_buffer(struct _vte_buffer *buffer, struct _vte_buffer *s)
-{
- struct _vte_real_buffer *buf = (struct _vte_real_buffer*) s;
- _vte_buffer_append_guint32(buffer, buf->buf_used);
- _vte_buffer_append(buffer, buf->bytes, buf->buf_used);
-}
-
-void
-_vte_buffer_append_buffer_contents(struct _vte_buffer *buffer,
- struct _vte_buffer *s)
-{
- _vte_buffer_append(buffer, s->bytes, _vte_buffer_length(s));
-}
-
-struct _vte_buffer *
-_vte_buffer_peek_buffer(struct _vte_buffer *buffer)
-{
- struct _vte_buffer *ret;
- guint32 i;
- i = _vte_buffer_peek_guint32(buffer);
- _vte_buffer_check(buffer, sizeof(i) + i);
- ret = _vte_buffer_new_with_data(buffer->bytes + sizeof(i), i);
- return ret;
-}
-
-struct _vte_buffer *
-_vte_buffer_read_buffer(struct _vte_buffer *buffer)
-{
- struct _vte_buffer *ret;
- guint32 i;
- i = _vte_buffer_read_guint32(buffer);
- _vte_buffer_check(buffer, i);
- ret = _vte_buffer_new_with_data(buffer->bytes, i);
- _vte_buffer_consume(buffer, i);
- return ret;
-}
-
-#ifdef BUFFER_MAIN
-int
-main(int argc, char **argv)
-{
- struct _vte_buffer *buffer, *tmp;
- GString *string;
- guint16 i16 = 0x1632;
- guint32 i32 = 0x20406080;
-
- string = g_string_new("Hello!");
- buffer = _vte_buffer_new();
- _vte_buffer_append_guint16(buffer, i16);
- _vte_buffer_append_guint32(buffer, i32);
- _vte_buffer_append_gstring(buffer, string);
- tmp = _vte_buffer_new();
- _vte_buffer_append_buffer_contents(tmp, buffer);
- _vte_buffer_append_buffer(tmp, buffer);
-
- /* Check the original buffer. */
- i16 = _vte_buffer_peek_guint16(buffer);
- g_print("%x ", i16);
- i16 = _vte_buffer_read_guint16(buffer);
- g_print("%x ", i16);
- i32 = _vte_buffer_peek_guint32(buffer);
- g_print("%x ", i32);
- i32 = _vte_buffer_read_guint32(buffer);
- g_print("%x ", i32);
- string = _vte_buffer_peek_gstring(buffer);
- g_print("'%s' ", string->str);
- g_string_free(string, TRUE);
- string = _vte_buffer_read_gstring(buffer);
- g_print("'%s'\n", string->str);
- g_string_free(string, TRUE);
- _vte_buffer_free(buffer);
-
- /* Check the first copy in the new buffer. */
- i16 = _vte_buffer_peek_guint16(tmp);
- g_print("%x ", i16);
- i16 = _vte_buffer_read_guint16(tmp);
- g_print("%x ", i16);
- i32 = _vte_buffer_peek_guint32(tmp);
- g_print("%x ", i32);
- i32 = _vte_buffer_read_guint32(tmp);
- g_print("%x ", i32);
- string = _vte_buffer_peek_gstring(tmp);
- g_print("'%s' ", string->str);
- g_string_free(string, TRUE);
- string = _vte_buffer_read_gstring(tmp);
- g_print("'%s'\n", string->str);
- g_string_free(string, TRUE);
-
- /* Peek at the second copy in the new buffer. */
- buffer = _vte_buffer_peek_buffer(tmp);
- i16 = _vte_buffer_peek_guint16(buffer);
- g_print("%x ", i16);
- i16 = _vte_buffer_read_guint16(buffer);
- g_print("%x ", i16);
- i32 = _vte_buffer_peek_guint32(buffer);
- g_print("%x ", i32);
- i32 = _vte_buffer_read_guint32(buffer);
- g_print("%x ", i32);
- string = _vte_buffer_peek_gstring(buffer);
- g_print("'%s' ", string->str);
- g_string_free(string, TRUE);
- string = _vte_buffer_read_gstring(buffer);
- g_print("'%s'\n", string->str);
- g_string_free(string, TRUE);
- _vte_buffer_free(buffer);
-
- /* Check the second copy in the new buffer. */
- buffer = _vte_buffer_read_buffer(tmp);
- i16 = _vte_buffer_peek_guint16(buffer);
- g_print("%x ", i16);
- i16 = _vte_buffer_read_guint16(buffer);
- g_print("%x ", i16);
- i32 = _vte_buffer_peek_guint32(buffer);
- g_print("%x ", i32);
- i32 = _vte_buffer_read_guint32(buffer);
- g_print("%x ", i32);
- string = _vte_buffer_peek_gstring(buffer);
- g_print("'%s' ", string->str);
- g_string_free(string, TRUE);
- string = _vte_buffer_read_gstring(buffer);
- g_print("'%s'\n", string->str);
- g_string_free(string, TRUE);
- _vte_buffer_free(buffer);
-
- _vte_buffer_free(tmp);
-
- return 0;
-}
-#endif
diff --git a/src/buffer.h b/src/buffer.h
index 66d325a..43f4222 100644
--- a/src/buffer.h
+++ b/src/buffer.h
@@ -35,11 +35,7 @@ struct _vte_buffer {
};
struct _vte_buffer* _vte_buffer_new(void);
-struct _vte_buffer* _vte_buffer_new_with_data(gconstpointer data,
- size_t length);
void _vte_buffer_free(struct _vte_buffer *buffer);
-void _vte_buffer_prepend(struct _vte_buffer *buffer,
- gconstpointer bytes, size_t length);
void _vte_buffer_append(struct _vte_buffer *buffer,
gconstpointer bytes, size_t length);
size_t _vte_buffer_length(struct _vte_buffer *buffer);
@@ -47,25 +43,6 @@ void _vte_buffer_consume(struct _vte_buffer *buffer, size_t length);
void _vte_buffer_clear(struct _vte_buffer *buffer);
void _vte_buffer_set_minimum_size(struct _vte_buffer *buffer, size_t length);
-void _vte_buffer_append_guint16(struct _vte_buffer *buffer, guint16 i);
-guint16 _vte_buffer_peek_guint16(struct _vte_buffer *buffer);
-guint16 _vte_buffer_read_guint16(struct _vte_buffer *buffer);
-
-void _vte_buffer_append_guint32(struct _vte_buffer *buffer, guint32 i);
-guint32 _vte_buffer_peek_guint32(struct _vte_buffer *buffer);
-guint32 _vte_buffer_read_guint32(struct _vte_buffer *buffer);
-
-void _vte_buffer_append_gstring(struct _vte_buffer *buffer, const GString *s);
-GString *_vte_buffer_peek_gstring(struct _vte_buffer *buffer);
-GString * _vte_buffer_read_gstring(struct _vte_buffer *buffer);
-
-void _vte_buffer_append_buffer(struct _vte_buffer *buffer,
- struct _vte_buffer *s);
-void _vte_buffer_append_buffer_contents(struct _vte_buffer *buffer,
- struct _vte_buffer *s);
-struct _vte_buffer *_vte_buffer_peek_buffer(struct _vte_buffer *buffer);
-struct _vte_buffer *_vte_buffer_read_buffer(struct _vte_buffer *buffer);
-
G_END_DECLS
#endif
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]