From 1c2da64348f85314e73494a0372cf26bb2cf821c Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Mon, 5 Sep 2011 12:29:54 +0300 Subject: [PATCH] gobex: Remove g_obex_packet_find_header This was exactly the same as g_obex_packet_get_header. --- gobex/gobex-packet.c | 14 -------------- gobex/gobex-packet.h | 1 - gobex/gobex.c | 6 +++--- tools/obex-server-tool.c | 8 ++++---- 4 files changed, 7 insertions(+), 22 deletions(-) diff --git a/gobex/gobex-packet.c b/gobex/gobex-packet.c index 5765c8b4f..e2914a4e3 100644 --- a/gobex/gobex-packet.c +++ b/gobex/gobex-packet.c @@ -79,20 +79,6 @@ guint8 g_obex_packet_get_operation(GObexPacket *pkt, gboolean *final) return pkt->opcode; } -GObexHeader *g_obex_packet_find_header(GObexPacket *pkt, guint8 id) -{ - GSList *l; - - for (l = pkt->headers; l != NULL; l = g_slist_next(l)) { - GObexHeader *hdr = l->data; - - if (g_obex_header_get_id(hdr) == id) - return hdr; - } - - return NULL; -} - gboolean g_obex_packet_prepend_header(GObexPacket *pkt, GObexHeader *header) { pkt->headers = g_slist_prepend(pkt->headers, header); diff --git a/gobex/gobex-packet.h b/gobex/gobex-packet.h index 6bdfcf039..24c9dcc98 100644 --- a/gobex/gobex-packet.h +++ b/gobex/gobex-packet.h @@ -84,7 +84,6 @@ typedef struct _GObexPacket GObexPacket; GObexHeader *g_obex_packet_get_header(GObexPacket *pkt, guint8 id); GObexHeader *g_obex_packet_get_body(GObexPacket *pkt); guint8 g_obex_packet_get_operation(GObexPacket *pkt, gboolean *final); -GObexHeader *g_obex_packet_find_header(GObexPacket *pkt, guint8 id); gboolean g_obex_packet_prepend_header(GObexPacket *pkt, GObexHeader *header); gboolean g_obex_packet_add_header(GObexPacket *pkt, GObexHeader *header); gboolean g_obex_packet_add_body(GObexPacket *pkt, GObexDataProducer func, diff --git a/gobex/gobex.c b/gobex/gobex.c index 5f9e9db74..b2c01990c 100644 --- a/gobex/gobex.c +++ b/gobex/gobex.c @@ -344,7 +344,7 @@ static void prepare_connect_rsp(GObex *obex, GObexPacket *rsp) init_connect_data(obex, &data); g_obex_packet_set_data(rsp, &data, sizeof(data), G_OBEX_DATA_COPY); - connid = g_obex_packet_find_header(rsp, G_OBEX_HDR_CONNECTION); + connid = g_obex_packet_get_header(rsp, G_OBEX_HDR_CONNECTION); if (connid != NULL) { g_obex_header_get_uint32(connid, &obex->conn_id); return; @@ -392,7 +392,7 @@ guint g_obex_send_req(GObex *obex, GObexPacket *req, gint timeout, if (obex->conn_id == CONNID_INVALID) goto create_pending; - connid = g_obex_packet_find_header(req, G_OBEX_HDR_CONNECTION); + connid = g_obex_packet_get_header(req, G_OBEX_HDR_CONNECTION); if (connid != NULL) goto create_pending; @@ -611,7 +611,7 @@ static void parse_connect_data(GObex *obex, GObexPacket *pkt) obex->tx_mtu = obex->io_tx_mtu; obex->tx_buf = g_realloc(obex->tx_buf, obex->tx_mtu); - connid = g_obex_packet_find_header(pkt, G_OBEX_HDR_CONNECTION); + connid = g_obex_packet_get_header(pkt, G_OBEX_HDR_CONNECTION); if (connid != NULL) g_obex_header_get_uint32(connid, &obex->conn_id); } diff --git a/tools/obex-server-tool.c b/tools/obex-server-tool.c index 4b39ba8a1..7db153e75 100644 --- a/tools/obex-server-tool.c +++ b/tools/obex-server-tool.c @@ -121,7 +121,7 @@ static void handle_put(GObex *obex, GObexPacket *req, gpointer user_data) struct transfer_data *data; gsize type_len; - hdr = g_obex_packet_find_header(req, G_OBEX_HDR_TYPE); + hdr = g_obex_packet_get_header(req, G_OBEX_HDR_TYPE); if (hdr != NULL) { g_obex_header_get_bytes(hdr, (const guint8 **) &type, &type_len); @@ -132,7 +132,7 @@ static void handle_put(GObex *obex, GObexPacket *req, gpointer user_data) } else type = NULL; - hdr = g_obex_packet_find_header(req, G_OBEX_HDR_NAME); + hdr = g_obex_packet_get_header(req, G_OBEX_HDR_NAME); if (hdr != NULL) g_obex_header_get_unicode(hdr, &name); else @@ -180,7 +180,7 @@ static void handle_get(GObex *obex, GObexPacket *req, gpointer user_data) GObexHeader *hdr; gsize type_len; - hdr = g_obex_packet_find_header(req, G_OBEX_HDR_TYPE); + hdr = g_obex_packet_get_header(req, G_OBEX_HDR_TYPE); if (hdr != NULL) { g_obex_header_get_bytes(hdr, (const guint8 **) &type, &type_len); @@ -191,7 +191,7 @@ static void handle_get(GObex *obex, GObexPacket *req, gpointer user_data) } else type = NULL; - hdr = g_obex_packet_find_header(req, G_OBEX_HDR_NAME); + hdr = g_obex_packet_get_header(req, G_OBEX_HDR_NAME); if (hdr != NULL) g_obex_header_get_unicode(hdr, &name); else -- 2.47.3