deprecate duplicated lws_protocol_get
authorAndy Green <andy@warmcat.com>
Tue, 17 May 2016 05:33:58 +0000 (13:33 +0800)
committerAndy Green <andy@warmcat.com>
Tue, 17 May 2016 05:33:58 +0000 (13:33 +0800)
Use the identical lws_get_protocol()

Signed-off-by: Andy Green <andy@warmcat.com>
lib/libwebsockets.h
plugin-standalone/protocol_example_standalone.c
plugins/protocol_dumb_increment.c
plugins/protocol_lws_mirror.c

index a692d09..68e136e 100644 (file)
@@ -1644,8 +1644,9 @@ lws_init_vhost_client_ssl(const struct lws_context_creation_info *info,
 LWS_VISIBLE LWS_EXTERN struct lws_vhost *
 lws_vhost_get(struct lws *wsi);
 
+/* deprecated: use lws_get_protocol */
 LWS_VISIBLE LWS_EXTERN const struct lws_protocols *
-lws_protocol_get(struct lws *wsi);
+lws_protocol_get(struct lws *wsi) LWS_WARN_DEPRECATED;
 
 LWS_VISIBLE LWS_EXTERN void *
 lws_protocol_vh_priv_zalloc(struct lws_vhost *vhost, const struct lws_protocols *prot,
index 003afc5..b292c3a 100644 (file)
@@ -56,7 +56,7 @@ callback_dumb_increment(struct lws *wsi, enum lws_callback_reasons reason,
        struct per_vhost_data__dumb_increment *vhd =
                        (struct per_vhost_data__dumb_increment *)
                        lws_protocol_vh_priv_get(lws_vhost_get(wsi),
-                                       lws_protocol_get(wsi));
+                                       lws_get_protocol(wsi));
        unsigned char buf[LWS_PRE + 512];
        unsigned char *p = &buf[LWS_PRE];
        int n, m;
@@ -64,10 +64,10 @@ callback_dumb_increment(struct lws *wsi, enum lws_callback_reasons reason,
        switch (reason) {
        case LWS_CALLBACK_PROTOCOL_INIT:
                vhd = lws_protocol_vh_priv_zalloc(lws_vhost_get(wsi),
-                               lws_protocol_get(wsi),
+                               lws_get_protocol(wsi),
                                sizeof(struct per_vhost_data__dumb_increment));
                vhd->context = lws_get_context(wsi);
-               vhd->protocol = lws_protocol_get(wsi);
+               vhd->protocol = lws_get_protocol(wsi);
                vhd->vhost = lws_vhost_get(wsi);
                uv_timer_init(lws_uv_getloop(vhd->context, 0),
                              &vhd->timeout_watcher);
index 5c1a343..798e06a 100644 (file)
@@ -52,7 +52,7 @@ callback_dumb_increment(struct lws *wsi, enum lws_callback_reasons reason,
        struct per_vhost_data__dumb_increment *vhd =
                        (struct per_vhost_data__dumb_increment *)
                        lws_protocol_vh_priv_get(lws_vhost_get(wsi),
-                                       lws_protocol_get(wsi));
+                                       lws_get_protocol(wsi));
        unsigned char buf[LWS_PRE + 512];
        unsigned char *p = &buf[LWS_PRE];
        int n, m;
@@ -60,10 +60,10 @@ callback_dumb_increment(struct lws *wsi, enum lws_callback_reasons reason,
        switch (reason) {
        case LWS_CALLBACK_PROTOCOL_INIT:
                vhd = lws_protocol_vh_priv_zalloc(lws_vhost_get(wsi),
-                               lws_protocol_get(wsi),
+                               lws_get_protocol(wsi),
                                sizeof(struct per_vhost_data__dumb_increment));
                vhd->context = lws_get_context(wsi);
-               vhd->protocol = lws_protocol_get(wsi);
+               vhd->protocol = lws_get_protocol(wsi);
                vhd->vhost = lws_vhost_get(wsi);
                uv_timer_init(lws_uv_getloop(vhd->context, 0),
                              &vhd->timeout_watcher);
index 44b8240..f61033d 100644 (file)
@@ -49,7 +49,7 @@ callback_lws_mirror(struct lws *wsi, enum lws_callback_reasons reason,
        struct per_vhost_data__lws_mirror *v =
                        (struct per_vhost_data__lws_mirror *)
                        lws_protocol_vh_priv_get(lws_vhost_get(wsi),
-                                       lws_protocol_get(wsi));
+                                       lws_get_protocol(wsi));
        int n, m;
 
        switch (reason) {
@@ -62,7 +62,7 @@ callback_lws_mirror(struct lws *wsi, enum lws_callback_reasons reason,
 
        case LWS_CALLBACK_PROTOCOL_INIT: /* per vhost */
                lws_protocol_vh_priv_zalloc(lws_vhost_get(wsi),
-                               lws_protocol_get(wsi),
+                               lws_get_protocol(wsi),
                                sizeof(struct per_vhost_data__lws_mirror));
                break;