[riot-notifications] [RIOT-OS/RIOT] uri_parser: constify result (#16707)

benpicco notifications at github.com
Thu Aug 5 14:01:47 CEST 2021


@benpicco commented on this pull request.



>  {
     netif_t *netif = NULL;
-    char *iface = ipv6_addr_split_iface(host);
+    const char *iface = strchr(host, '%') + 1;

I still don't see how this requires the new API - wouldn't this just be

```patch
--- a/pkg/wakaama/contrib/lwm2m_client_connection.c
+++ b/pkg/wakaama/contrib/lwm2m_client_connection.c
@@ -220,10 +220,9 @@ static int _connection_send(lwm2m_client_connection_t *conn, uint8_t *buffer,
     return 0;
 }
 
-static netif_t *_get_interface(const char *host)
+static netif_t *_get_interface(const char *iface)
 {
     netif_t *netif = NULL;
-    const char *iface = strchr(host, '%') + 1;
 
     if (iface == NULL) {
         /* get the number of net interfaces */
@@ -330,7 +329,7 @@ static lwm2m_client_connection_t *_connection_create(uint16_t sec_obj_inst_id,
      * if not, check the number of interfaces and default to the first if there
      * is only one defined. */
     if (ipv6_addr_is_link_local((ipv6_addr_t *)&conn->remote.addr.ipv6)) {
-        netif_t *netif = _get_interface(parsed_uri.host);
+        netif_t *netif = _get_interface(parsed_uri.zoneid);
         if (netif == NULL) {
             goto free_out;
         }
```

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/16707#discussion_r683387693
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20210805/747f4d19/attachment.htm>


More information about the notifications mailing list