summaryrefslogtreecommitdiff
path: root/net-libs/openslp/files/openslp-2.0.0-namespace.patch
blob: b5e817877406be7418d0b6b8688cda7f1402237d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
# HG changeset patch
# User John Calcote <john.calcote@gmail.com>
# Date 1491588156 21600
#      Fri Apr 07 12:02:36 2017 -0600
# Node ID 51ed69107d096c5b9886954d89e0709975d5aa15
# Parent  c1c294ce953e35f757020b01314cfc49556ccc0c
BUG#149: cleanup libslp namespace; fix ctype function calls throughout.

diff -ruN openslp-2.0.0.orig/common/slp_compare.c openslp-2.0.0/common/slp_compare.c
--- openslp-2.0.0.orig/common/slp_compare.c	2017-06-10 01:15:33.214875294 +0200
+++ openslp-2.0.0/common/slp_compare.c	2017-06-10 01:16:39.072878034 +0200
@@ -83,9 +83,10 @@
  *
  * @internal
  */
-int strncasecmp(const char * s1, const char * s2, size_t len)
+int slp_strncasecmp(const char * s1, const char * s2, size_t len)
 {
-   while (*s1 && (*s1 == *s2 || tolower(*s1) == tolower(*s2)))
+   while (*s1 && (*s1 == *s2
+         || tolower((unsigned char)*s1) == tolower((unsigned char)*s2)))
    {
       len--;
       if (len == 0)
@@ -93,7 +94,7 @@
       s1++;
       s2++;
    }
-   return len? (int)(*(unsigned char *)s1 - (int)*(unsigned char *)s2): 0;
+   return len? (unsigned char)*s1 - (unsigned char)*s2: 0;
 }
 # endif
 
@@ -113,11 +114,12 @@
  *
  * @internal
  */
-int strcasecmp(const char * s1, const char * s2)
+int slp_strcasecmp(const char * s1, const char * s2)
 {
-   while (*s1 && (*s1 == *s2 || tolower(*s1) == tolower(*s2)))
+   while (*s1 && (*s1 == *s2 
+         || tolower((unsigned char)*s1) == tolower((unsigned char)*s2)))
       s1++, s2++;
-   return (int)(*(unsigned char *)s1 - (int)*(unsigned char *)s2);
+   return (unsigned char)*s1 - (unsigned char)*s2;
 }
 # endif
 #endif
@@ -202,13 +204,13 @@
    char * p = str, * ep = str + len;
    while (p < ep)
    {
-      if (isspace(*p))
+      if (isspace((unsigned char)*p))
       {
-         char * ws2p = ++p;            /* Point ws2p to the second ws char. */
-         while (p < ep && isspace(*p)) /* Scan till we hit a non-ws char. */
+         char * ws2p = ++p;                           /* Point ws2p to the second ws char. */
+         while (p < ep && isspace((unsigned char)*p)) /* Scan till we hit a non-ws char. */
             p++;
-         len -= p - ws2p;              /* Reduce the length by extra ws. */
-         memmove(ws2p, p, ep - p);     /* Overwrite the extra white space. */
+         len -= p - ws2p;                             /* Reduce the length by extra ws. */
+         memmove(ws2p, p, ep - p);                    /* Overwrite the extra white space. */
       }
       p++;
    }
@@ -276,9 +278,9 @@
    char *upd = dststr;
    while (len > 0 && *srcstr)
    {
-      if (isspace(*srcstr))
+      if (isspace((unsigned char)*srcstr))
       {
-         while (isspace(*srcstr) && len > 0)
+         while (isspace((unsigned char)*srcstr) && len > 0)
          {
             ++srcstr, --len;
          }
@@ -311,7 +313,7 @@
       }
       else
       {
-         *upd++ = (char)tolower(*srcstr++);
+         *upd++ = (char)tolower((unsigned char)*srcstr++);
          --len;
       }
    }
@@ -340,15 +342,15 @@
    char * cpy1, * cpy2;
 
    /* Remove leading white space. */
-   while (str1len && isspace(*str1))
+   while (str1len && isspace((unsigned char)*str1))
       str1++, str1len--;
-   while (str2len && isspace(*str2))
+   while (str2len && isspace((unsigned char)*str2))
       str2++, str2len--;
 
    /* Remove trailing white space. */
-   while (str1len && isspace(str1[str1len - 1]))
+   while (str1len && isspace((unsigned char)str1[str1len - 1]))
       str1len--;
-   while (str2len && isspace(str2[str2len - 1]))
+   while (str2len && isspace((unsigned char)str2[str2len - 1]))
       str2len--;
 
    /*A quick check for empty strings before we start xmemduping and xfreeing*/
diff -ruN openslp-2.0.0.orig/common/slp_compare.h openslp-2.0.0/common/slp_compare.h
--- openslp-2.0.0.orig/common/slp_compare.h	2012-11-28 18:07:04.000000000 +0100
+++ openslp-2.0.0/common/slp_compare.h	2017-06-10 01:16:39.072878034 +0200
@@ -52,10 +52,12 @@
 
 #ifndef _WIN32
 # ifndef HAVE_STRNCASECMP
-int strncasecmp(const char * s1, const char * s2, size_t len);
+int slp_strncasecmp(const char * s1, const char * s2, size_t len);
+# define strncasecmp slp_strncasecmp
 # endif
 # ifndef HAVE_STRCASECMP
-int strcasecmp(const char * s1, const char * s2);
+int slp_strcasecmp(const char * s1, const char * s2);
+# define strcasecmp slp_strcasecmp
 # endif
 #endif
 
diff -ruN openslp-2.0.0.orig/common/slp_dhcp.c openslp-2.0.0/common/slp_dhcp.c
--- openslp-2.0.0.orig/common/slp_dhcp.c	2012-12-07 01:52:08.000000000 +0100
+++ openslp-2.0.0/common/slp_dhcp.c	2017-06-10 01:16:39.073878034 +0200
@@ -405,7 +405,7 @@
  *    ENOTCONN (read error), ETIMEDOUT (read timeout), ENOMEM (out of
  *    memory), or EINVAL (on parse error).
  */
-int DHCPGetOptionInfo(unsigned char * dhcpOptCodes, int dhcpOptCodeCnt, 
+int slp_DHCPGetOptionInfo(unsigned char * dhcpOptCodes, int dhcpOptCodeCnt, 
       DHCPInfoCallBack * dhcpInfoCB, void * context)
 {
    uint32_t xid;
@@ -539,7 +539,7 @@
  * @return Zero on success, or a non-zero value to stop the caller from 
  *    continuing to parse the buffer and call this routine.
  */
-int DHCPParseSLPTags(int tag, void * optdata, size_t optdatasz, 
+int slp_DHCPParseSLPTags(int tag, void * optdata, size_t optdatasz, 
       void * context)
 {
    size_t cpysz, bufsz, dasize;
@@ -707,8 +707,8 @@
    ctx.scopelistlen = 0;
    ctx.addrlistlen = 0;
 
-   if ((err = DHCPGetOptionInfo(dhcpOpts, sizeof(dhcpOpts), 
-         DHCPParseSLPTags, &ctx)) != 0)
+   if ((err = slp_DHCPGetOptionInfo(dhcpOpts, sizeof(dhcpOpts), 
+         slp_DHCPParseSLPTags, &ctx)) != 0)
       return FAIL;
 
    printf("ScopeList: [%.*s]\n", ctx.scopelistlen, ctx.scopelist);
diff -ruN openslp-2.0.0.orig/common/slp_dhcp.h openslp-2.0.0/common/slp_dhcp.h
--- openslp-2.0.0.orig/common/slp_dhcp.h	2012-11-28 18:07:04.000000000 +0100
+++ openslp-2.0.0/common/slp_dhcp.h	2017-06-10 01:16:39.073878034 +0200
@@ -131,10 +131,10 @@
 typedef int DHCPInfoCallBack(int tag, void * optdata, 
       size_t optdatasz, void * context);
 
-int DHCPGetOptionInfo(unsigned char * dhcpOptCodes, int dhcpOptCodeCnt, 
+int slp_DHCPGetOptionInfo(unsigned char * dhcpOptCodes, int dhcpOptCodeCnt, 
       DHCPInfoCallBack * dhcpInfoCB, void * context);
 
-int DHCPParseSLPTags(int tag, void * optdata, size_t optdatasz, 
+int slp_DHCPParseSLPTags(int tag, void * optdata, size_t optdatasz, 
       void * context);
 
 /** DHCP interface context structure */
diff -ruN openslp-2.0.0.orig/common/slp_iface.c openslp-2.0.0/common/slp_iface.c
--- openslp-2.0.0.orig/common/slp_iface.c	2012-12-11 00:31:53.000000000 +0100
+++ openslp-2.0.0/common/slp_iface.c	2017-06-10 01:16:39.073878034 +0200
@@ -645,7 +645,7 @@
  *
  * @internal
  */
-int sizeof_ifreq(struct ifreq* ifr)
+static int sizeof_ifreq(struct ifreq* ifr)
 {
 #ifdef HAVE_SOCKADDR_STORAGE_SS_LEN
   int len = ifr->ifr_addr.sa_len + sizeof(ifr->ifr_name);
diff -ruN openslp-2.0.0.orig/common/slp_message.c openslp-2.0.0/common/slp_message.c
--- openslp-2.0.0.orig/common/slp_message.c	2012-12-11 00:31:53.000000000 +0100
+++ openslp-2.0.0/common/slp_message.c	2017-06-10 01:16:39.073878034 +0200
@@ -58,7 +58,7 @@
  * @return A 16-bit unsigned value in native format; the buffer pointer
  *    is moved ahead by 2 bytes on return.
  */
-uint16_t GetUINT16(uint8_t ** cpp)
+uint16_t slp_GetUINT16(uint8_t ** cpp)
 {
    uint16_t rv = AS_UINT16(*cpp);
    *cpp += 2;
@@ -72,7 +72,7 @@
  * @return A 32-bit unsigned value in native format; the buffer pointer
  *    is moved ahead by 3 bytes on return.
  */
-uint32_t GetUINT24(uint8_t ** cpp)
+uint32_t slp_GetUINT24(uint8_t ** cpp)
 {
    uint32_t rv = AS_UINT24(*cpp);
    *cpp += 3;
@@ -86,7 +86,7 @@
  * @return A 32-bit unsigned value in native format; the buffer pointer
  *    is moved ahead by 4 bytes on return.
  */
-uint32_t GetUINT32(uint8_t ** cpp)
+uint32_t slp_GetUINT32(uint8_t ** cpp)
 {
    uint32_t rv = AS_UINT32(*cpp);
    *cpp += 4;
@@ -106,7 +106,7 @@
  *    @p cppstring pointer; the buffer pointer is moved ahead by @p len bytes
  *    on return.
  */
-char * GetStrPtr(uint8_t ** cpp, size_t len)
+char * slp_GetStrPtr(uint8_t ** cpp, size_t len)
 {
    char * sp = (char *)*cpp;
    *cpp += len;
@@ -120,7 +120,7 @@
  *
  * @note The buffer address is moved ahead by 2 bytes on return.
  */
-void PutUINT16(uint8_t ** cpp, size_t val)
+void slp_PutUINT16(uint8_t ** cpp, size_t val)
 {
    TO_UINT16(*cpp, val);
    *cpp += 2;
@@ -133,7 +133,7 @@
  *
  * @note The buffer address is moved ahead by 3 bytes on return.
  */
-void PutUINT24(uint8_t ** cpp, size_t val)
+void slp_PutUINT24(uint8_t ** cpp, size_t val)
 {
    TO_UINT24(*cpp, val);
    *cpp += 3;
@@ -146,7 +146,7 @@
  *
  * @note The buffer address is moved ahead by 4 bytes on return.
  */
-void PutUINT32(uint8_t ** cpp, size_t val)
+void slp_PutUINT32(uint8_t ** cpp, size_t val)
 {
    TO_UINT32(*cpp, val);
    *cpp += 4;
diff -ruN openslp-2.0.0.orig/common/slp_message.h openslp-2.0.0/common/slp_message.h
--- openslp-2.0.0.orig/common/slp_message.h	2012-12-07 21:13:28.000000000 +0100
+++ openslp-2.0.0/common/slp_message.h	2017-06-10 01:16:39.073878034 +0200
@@ -188,14 +188,23 @@
 #define PEEK_LENGTH(p) ((*p == 2) ? AS_UINT24(p + 2) : (*p == 1) ? AS_UINT16(p + 2) : 1)
 
 /* buffer-based wire routines */
-uint16_t GetUINT16(uint8_t ** cpp);
-uint32_t GetUINT24(uint8_t ** cpp);
-uint32_t GetUINT32(uint8_t ** cpp);
-char * GetStrPtr(uint8_t ** cpp, size_t length);
+uint16_t slp_GetUINT16(uint8_t ** cpp);
+uint32_t slp_GetUINT24(uint8_t ** cpp);
+uint32_t slp_GetUINT32(uint8_t ** cpp);
+char * slp_GetStrPtr(uint8_t ** cpp, size_t length);
 
-void PutUINT16(uint8_t ** cpp, size_t val);
-void PutUINT24(uint8_t ** cpp, size_t val);
-void PutUINT32(uint8_t ** cpp, size_t val);
+void slp_PutUINT16(uint8_t ** cpp, size_t val);
+void slp_PutUINT24(uint8_t ** cpp, size_t val);
+void slp_PutUINT32(uint8_t ** cpp, size_t val);
+
+#define GetUINT16 slp_GetUINT16
+#define GetUINT24 slp_GetUINT24
+#define GetUINT32 slp_GetUINT32
+#define GetStrPtr slp_GetStrPtr
+
+#define PutUINT16 slp_PutUINT16
+#define PutUINT24 slp_PutUINT24
+#define PutUINT32 slp_PutUINT32
 
 /** SLPHeader structure and associated functions */
 typedef struct _SLPHeader
diff -ruN openslp-2.0.0.orig/common/slp_net.c openslp-2.0.0/common/slp_net.c
--- openslp-2.0.0.orig/common/slp_net.c	2012-12-11 00:31:53.000000000 +0100
+++ openslp-2.0.0/common/slp_net.c	2017-06-10 01:16:39.073878034 +0200
@@ -76,18 +76,20 @@
 #endif
 
 /** IPv6 SLP address constants */
-const struct in6_addr in6addr_srvloc_node       = IN6ADDR_SRVLOC_NODE_INIT;
-const struct in6_addr in6addr_srvloc_link       = IN6ADDR_SRVLOC_LINK_INIT;
-const struct in6_addr in6addr_srvloc_site       = IN6ADDR_SRVLOC_SITE_INIT;
-const struct in6_addr in6addr_srvlocda_node     = IN6ADDR_SRVLDA_NODE_INIT;
-const struct in6_addr in6addr_srvlocda_link     = IN6ADDR_SRVLDA_LINK_INIT;
-const struct in6_addr in6addr_srvlocda_site     = IN6ADDR_SRVLDA_SITE_INIT;
-const struct in6_addr in6addr_service_node_mask = IN6ADDR_SVCNOD_MASK_INIT;
-const struct in6_addr in6addr_service_link_mask = IN6ADDR_SVCLNK_MASK_INIT;
-const struct in6_addr in6addr_service_site_mask = IN6ADDR_SVCSIT_MASK_INIT;
-const struct in6_addr slp_in6addr_any           = SLP_IN6ADDR_ANY_INIT;
-const struct in6_addr slp_in6addr_loopback      = SLP_IN6ADDR_LOOPBACK_INIT;
+const struct in6_addr in6addr_srvloc_node   = IN6ADDR_SRVLOC_NODE_INIT;
+const struct in6_addr in6addr_srvloc_link   = IN6ADDR_SRVLOC_LINK_INIT;
+const struct in6_addr in6addr_srvloc_site   = IN6ADDR_SRVLOC_SITE_INIT;
 
+const struct in6_addr in6addr_srvlocda_node = IN6ADDR_SRVLDA_NODE_INIT;
+const struct in6_addr in6addr_srvlocda_link = IN6ADDR_SRVLDA_LINK_INIT;
+const struct in6_addr in6addr_srvlocda_site = IN6ADDR_SRVLDA_SITE_INIT;
+
+const struct in6_addr slp_in6addr_any      = SLP_IN6ADDR_ANY_INIT;
+const struct in6_addr slp_in6addr_loopback = SLP_IN6ADDR_LOOPBACK_INIT;
+
+static const struct in6_addr in6addr_service_node_mask = IN6ADDR_SVCNOD_MASK_INIT;
+static const struct in6_addr in6addr_service_link_mask = IN6ADDR_SVCLNK_MASK_INIT;
+static const struct in6_addr in6addr_service_site_mask = IN6ADDR_SVCSIT_MASK_INIT;
 
 /** Returns the scope embedded in the IPv6 multicast address.
  *
diff -ruN openslp-2.0.0.orig/common/slp_net.h openslp-2.0.0/common/slp_net.h
--- openslp-2.0.0.orig/common/slp_net.h	2012-12-11 00:31:53.000000000 +0100
+++ openslp-2.0.0/common/slp_net.h	2017-06-10 01:16:39.073878034 +0200
@@ -65,9 +65,6 @@
 extern const struct in6_addr in6addr_srvlocda_node;
 extern const struct in6_addr in6addr_srvlocda_link;
 extern const struct in6_addr in6addr_srvlocda_site;
-extern const struct in6_addr in6addr_service_node_mask;
-extern const struct in6_addr in6addr_service_link_mask;
-/* extern const struct in6_addr in6addr_service_site_mask; */
 
 /** IN6 "Any" and "Loopback" address initializer macros */
 #ifdef _AIX
diff -ruN openslp-2.0.0.orig/common/slp_network.c openslp-2.0.0/common/slp_network.c
--- openslp-2.0.0.orig/common/slp_network.c	2013-06-08 04:50:38.000000000 +0200
+++ openslp-2.0.0/common/slp_network.c	2017-06-10 01:16:39.073878034 +0200
@@ -364,7 +364,7 @@
  * @returns A const pointer to @p dst on success; or NULL on failure, 
  *    and sets @a errno to EAFNOSUPPORT.
  */ 
-const char * saddr_ntop(const void * src, char * dst, size_t dstsz)
+const char * slp_saddr_ntop(const void * src, char * dst, size_t dstsz)
 {
    switch (((const struct sockaddr *)src)->sa_family)
    {
diff -ruN openslp-2.0.0.orig/common/slp_network.h openslp-2.0.0/common/slp_network.h
--- openslp-2.0.0.orig/common/slp_network.h	2012-11-28 18:07:04.000000000 +0100
+++ openslp-2.0.0/common/slp_network.h	2017-06-10 01:16:39.073878034 +0200
@@ -62,7 +62,7 @@
       size_t bufsz, void * peeraddr, struct timeval * timeout);  
 int SLPNetworkRecvMessage(sockfd_t sockfd, int socktype, SLPBuffer * buf,
       void * peeraddr, struct timeval * timeout); 
-const char * saddr_ntop(const void * src, char * dst, size_t dstsz);
+const char * slp_saddr_ntop(const void * src, char * dst, size_t dstsz);
 
 void SLPNetworkSetSndRcvBuf(sockfd_t sock);
 /*! @} */
diff -ruN openslp-2.0.0.orig/common/slp_v1message.c openslp-2.0.0/common/slp_v1message.c
--- openslp-2.0.0.orig/common/slp_v1message.c	2012-12-11 00:31:53.000000000 +0100
+++ openslp-2.0.0/common/slp_v1message.c	2017-06-10 01:16:39.073878034 +0200
@@ -275,10 +275,10 @@
          || (tmp = strstr(srvreg->attrlist, "scope")) != 0)
    {
       tmp += 5;
-      while (*tmp && (isspace(*tmp) || *tmp == '='))
+      while (*tmp && (isspace((unsigned char)*tmp) || *tmp == '='))
          tmp++;      /* Find start of scope string. */
       srvreg->scopelist = tmp;
-      while (*tmp && !isspace(*tmp) && *tmp != ')')
+      while (*tmp && !isspace((unsigned char)*tmp) && *tmp != ')')
          tmp++;      /* Find end of scope string. */
       srvreg->scopelistlen = tmp - srvreg->scopelist;
       /** @todo Should we convert to UTF-8 here? */
diff -ruN openslp-2.0.0.orig/common/slp_xmalloc.c openslp-2.0.0/common/slp_xmalloc.c
--- openslp-2.0.0.orig/common/slp_xmalloc.c	2017-06-10 01:15:33.209875294 +0200
+++ openslp-2.0.0/common/slp_xmalloc.c	2017-06-10 01:18:31.228882700 +0200
@@ -106,7 +106,7 @@
  *
  * @return A pointer to the newly allocated memory block.
  */
-void * _xmalloc(const char * file, int line, size_t size)
+void * slp_xmalloc(const char * file, int line, size_t size)
 {
    xallocation_t * x;
 
@@ -161,10 +161,10 @@
  *
  * @return A pointer to the newly allocated and cleared memory block.
  */
-void * _xcalloc(const char * file, int line, int numblks, size_t size)
+void * slp_xcalloc(const char * file, int line, int numblks, size_t size)
 {
    size_t blksz = numblks * size;
-   void * ptr = _xmalloc(file, line, blksz);
+   void * ptr = slp_xmalloc(file, line, blksz);
    if (ptr)
       memset(ptr, 0, blksz);
    return ptr;
@@ -183,16 +183,16 @@
  *    NULL for @p buf actually allocates a new buffer, passing 0 
  *    for @p size actually allocates a new buffer.
  */
-void * _xrealloc(const char * file, int line, void * ptr, size_t size)
+void * slp_xrealloc(const char * file, int line, void * ptr, size_t size)
 {
    xallocation_t * x;
 
    if (!ptr)
-      return _xmalloc(file, line, size);
+      return slp_xmalloc(file, line, size);
 
    if (!size)
    {
-      _xfree(file, line, ptr);
+      slp_xfree(file, line, ptr);
       return 0;
    }
 
@@ -202,11 +202,11 @@
       void * newptr = ptr;
       if (x->size != size)
       {
-         newptr = _xmalloc(file, line, size);
+         newptr = slp_xmalloc(file, line, size);
          if (newptr == 0)
             return 0;
          memcpy(newptr, ptr, x->size);
-         _xfree(file, line, x);
+         slp_xfree(file, line, x);
       }
       return newptr;
    }
@@ -227,10 +227,10 @@
  * @return A pointer to the duplicated string, or NULL on memory
  *    allocation failure.
  */
-char * _xstrdup(const char * file, int line, const char * str)
+char * slp_xstrdup(const char * file, int line, const char * str)
 {
    size_t strsz = strlen(str) + 1;
-   char * ptr = _xmalloc(file, line, strsz);
+   char * ptr = slp_xmalloc(file, line, strsz);
    if (ptr)
       memcpy(ptr, str, strsz);
    return ptr;
@@ -246,9 +246,9 @@
  * @return A pointer to the duplicated memory block, or NULL on memory
  *    allocation failure.
  */
-void * _xmemdup(const char * file, int line, const void * ptr, size_t size)
+void * slp_xmemdup(const char * file, int line, const void * ptr, size_t size)
 {
-   void * cpy = _xmalloc(file, line, size);
+   void * cpy = slp_xmalloc(file, line, size);
    if (cpy)
       memcpy(cpy, ptr, size);
    return cpy;
@@ -260,7 +260,7 @@
  * @param[in] line - The line number where @e xfree was called.
  * @param[in] ptr - The address of the block to be free'd.
  */
-void _xfree(const char * file, int line, void * ptr)
+void slp_xfree(const char * file, int line, void * ptr)
 {
    xallocation_t * x;
 
@@ -292,7 +292,7 @@
  * @return A boolean true (1) on success, or false (0) the log file 
  *    fails to open.
 */
-int xmalloc_init(const char * filename, size_t freemem)
+int slp_xmalloc_init(const char * filename, size_t freemem)
 {
    G_xmalloc_fh = fopen(filename, "w");
    if (G_xmalloc_fh == 0)
@@ -305,7 +305,7 @@
  *
  * @return 0
  */
-int xmalloc_report(void)
+int slp_xmalloc_report(void)
 {
    xallocation_t * x;
 
@@ -327,7 +327,7 @@
 
 /** Deinitialize the debug memory allocator.
  */
-void xmalloc_deinit(void)
+void slp_xmalloc_deinit(void)
 {
    xmalloc_report();
 
@@ -352,7 +352,7 @@
  * @return A pointer to the duplicated memory block, or NULL on memory
  *    allocation failure.
  */
-void * _xmemdup(const void * ptr, size_t size)
+void * slp_xmemdup(const void * ptr, size_t size)
 {
    void * cpy = malloc(size);
    if (cpy)
diff -ruN openslp-2.0.0.orig/common/slp_xmalloc.h openslp-2.0.0/common/slp_xmalloc.h
--- openslp-2.0.0.orig/common/slp_xmalloc.h	2012-11-28 18:07:04.000000000 +0100
+++ openslp-2.0.0/common/slp_xmalloc.h	2017-06-10 01:16:39.073878034 +0200
@@ -63,34 +63,38 @@
    size_t size;
 } xallocation_t;
 
-void * _xmalloc(const char * file, int line, size_t size);
-void * _xcalloc(const char * file, int line, int numblks, size_t size);
-void * _xrealloc(const char * file, int line, void * ptr, size_t size);
-char * _xstrdup(const char * file, int line, const char * str);
-void * _xmemdup(const char * file, int line, const void * ptr, size_t size);
-void   _xfree(const char * file, int line, void * ptr);
-
-int xmalloc_init(const char * filename, size_t freemem);
-int xmalloc_report(void);
-void xmalloc_deinit(void);
-
-#define xmalloc(s)      _xmalloc(__FILE__,__LINE__,(s))
-#define xcalloc(n,s)    _xcalloc(__FILE__,__LINE__,(n),(s))
-#define xrealloc(p,s)   _xrealloc(__FILE__,__LINE__,(p),(s))
-#define xfree(p)        _xfree(__FILE__,__LINE__,(p))
-#define xstrdup(p)      _xstrdup(__FILE__,__LINE__,(p))
-#define xmemdup(p,s)    _xmemdup(__FILE__,__LINE__,(p),(s))
+void * slp_xmalloc(const char * file, int line, size_t size);
+void * slp_xcalloc(const char * file, int line, int numblks, size_t size);
+void * slp_xrealloc(const char * file, int line, void * ptr, size_t size);
+char * slp_xstrdup(const char * file, int line, const char * str);
+void * slp_xmemdup(const char * file, int line, const void * ptr, size_t size);
+void   slp_xfree(const char * file, int line, void * ptr);
+
+int slp_xmalloc_init(const char * filename, size_t freemem);
+int slp_xmalloc_report(void);
+void slp_xmalloc_deinit(void);
+
+#define xmalloc(s)      slp_xmalloc(__FILE__,__LINE__,(s))
+#define xcalloc(n,s)    slp_xcalloc(__FILE__,__LINE__,(n),(s))
+#define xrealloc(p,s)   slp_xrealloc(__FILE__,__LINE__,(p),(s))
+#define xfree(p)        slp_xfree(__FILE__,__LINE__,(p))
+#define xstrdup(p)      slp_xstrdup(__FILE__,__LINE__,(p))
+#define xmemdup(p,s)    slp_xmemdup(__FILE__,__LINE__,(p),(s))
+
+#define xmalloc_init    slp_xmalloc_init
+#define xmalloc_report  slp_xmalloc_report
+#define xmalloc_deinit  slp_xmalloc_deinit
 
 #else    /* ?DEBUG */
 
-void * _xmemdup(const void * ptr, size_t srclen);
+void * slp_xmemdup(const void * ptr, size_t srclen);
 
 #define xmalloc   malloc
 #define xcalloc   calloc
 #define xrealloc  realloc
 #define xfree     free
 #define xstrdup   strdup
-#define xmemdup   _xmemdup
+#define xmemdup   slp_xmemdup
 
 #endif   /* ?DEBUG */
 
diff -ruN openslp-2.0.0.orig/libslp/libslp.h openslp-2.0.0/libslp/libslp.h
--- openslp-2.0.0.orig/libslp/libslp.h	2012-11-28 18:07:04.000000000 +0100
+++ openslp-2.0.0/libslp/libslp.h	2017-06-10 01:16:39.073878034 +0200
@@ -263,11 +263,15 @@
 
 void KnownDAFreeAll(void);
 
-void PutL16String(uint8_t ** cpp, const char * str, size_t strsz);
-size_t SizeofURLEntry(size_t urllen, size_t urlauthlen);
-void PutURLEntry(uint8_t ** cpp, uint16_t lifetime, const char * url,
+void slp_PutL16String(uint8_t ** cpp, const char * str, size_t strsz);
+size_t slp_SizeofURLEntry(size_t urllen, size_t urlauthlen);
+void slp_PutURLEntry(uint8_t ** cpp, uint16_t lifetime, const char * url,
       size_t urllen, const uint8_t * urlauth, size_t urlauthlen);
 
+#define PutL16String   slp_PutL16String
+#define SizeofURLEntry slp_SizeofURLEntry
+#define PutURLEntry    slp_PutURLEntry
+
 int LIBSLPPropertyInit(char const * gconffile);
 void LIBSLPPropertyCleanup();
 
diff -ruN openslp-2.0.0.orig/libslp/libslp_knownda.c openslp-2.0.0/libslp/libslp_knownda.c
--- openslp-2.0.0.orig/libslp/libslp_knownda.c	2012-12-12 18:38:52.000000000 +0100
+++ openslp-2.0.0/libslp/libslp_knownda.c	2017-06-10 01:16:39.074878034 +0200
@@ -520,7 +520,7 @@
    *ctx.scopelist = 0;
    ctx.addrlistlen = 0;
 
-   DHCPGetOptionInfo(dhcpOpts, sizeof(dhcpOpts), DHCPParseSLPTags, &ctx);
+   slp_DHCPGetOptionInfo(dhcpOpts, sizeof(dhcpOpts), slp_DHCPParseSLPTags, &ctx);
 
    if (!*ctx.scopelist)
    {
diff -ruN openslp-2.0.0.orig/libslp/libslp_network.c openslp-2.0.0/libslp/libslp_network.c
--- openslp-2.0.0.orig/libslp/libslp_network.c	2013-06-08 04:50:38.000000000 +0200
+++ openslp-2.0.0/libslp/libslp_network.c	2017-06-10 01:16:39.074878034 +0200
@@ -142,7 +142,7 @@
  *
  * @internal
  */
-void timeval_subtract(struct timeval *lhs, struct timeval *rhs)
+static void timeval_subtract(struct timeval *lhs, struct timeval *rhs)
 {
     lhs->tv_sec -= rhs->tv_sec;
     lhs->tv_usec -= rhs->tv_usec;
@@ -162,7 +162,7 @@
  *
  * @internal
  */
-void timeval_add(struct timeval *lhs, struct timeval *rhs)
+static void timeval_add(struct timeval *lhs, struct timeval *rhs)
 {
     lhs->tv_sec += rhs->tv_sec;
     lhs->tv_usec += rhs->tv_usec;
@@ -183,7 +183,7 @@
  *
  * @return the size
  */
-size_t CalcBufferSize(int v1, char buftype, size_t langsize, size_t prlistlen, size_t bufsize)
+static size_t CalcBufferSize(int v1, char buftype, size_t langsize, size_t prlistlen, size_t bufsize)
 {
    size_t size = 0;
 
diff -ruN openslp-2.0.0.orig/libslp/libslp_parse.c openslp-2.0.0/libslp/libslp_parse.c
--- openslp-2.0.0.orig/libslp/libslp_parse.c	2012-12-11 00:31:53.000000000 +0100
+++ openslp-2.0.0/libslp/libslp_parse.c	2017-06-10 01:16:39.074878034 +0200
@@ -102,10 +102,10 @@
  *    next buffer position after the URL Entry written on exit.
  *
  * @remarks Currently OpenSLP only handles a single authentication
- *    block. To handle more than this, PutURLEntry would have to take
+ *    block. To handle more than this, slp_PutURLEntry would have to take
  *    arrays of @p urlauth and @p urlauthlen values.
  */
-void PutURLEntry(uint8_t ** cpp, uint16_t lifetime, const char * url,
+void slp_PutURLEntry(uint8_t ** cpp, uint16_t lifetime, const char * url,
       size_t urllen, const uint8_t * urlauth, size_t urlauthlen)
 {
    uint8_t * curpos = *cpp;
diff -ruN openslp-2.0.0.orig/libslpattr/libslpattr.c openslp-2.0.0/libslpattr/libslpattr.c
--- openslp-2.0.0.orig/libslpattr/libslpattr.c	2012-12-11 00:31:53.000000000 +0100
+++ openslp-2.0.0/libslpattr/libslpattr.c	2017-06-10 01:16:39.074878034 +0200
@@ -134,8 +134,8 @@
  */
 static char unescape(char d1, char d2)
 {
-   SLP_ASSERT(isxdigit((int) d1));
-   SLP_ASSERT(isxdigit((int) d2));
+   SLP_ASSERT(isxdigit((unsigned char)d1));
+   SLP_ASSERT(isxdigit((unsigned char)d2));
 
    if ((d1 >= 'A') && (d1 <= 'F'))
       d1 = d1 - 'A' + 0x0A;
@@ -184,8 +184,8 @@
          /*** Check that the characters are legal, and that the value has
           * not been truncated.
           ***/
-         if ((i + 2 < len) && isxdigit((int) src[i + 1]) && isxdigit((int)
-                                                                  src[i + 2]))
+         if ((i + 2 < len) && isxdigit((unsigned char)src[i + 1]) 
+               && isxdigit((unsigned char)src[i + 2]))
          {
             *write = unescape(src[i + 1], src[i + 2]);
             i += 2;
@@ -2049,14 +2049,14 @@
 
 
    /***** Check integer *****/
-   if (*val == '-' || isdigit((int) * val))
+   if (*val == '-' || isdigit((unsigned char)*val))
    {
       /*** Verify. ***/
       SLPBoolean is_int = SLP_TRUE; /* Flag true if the attr is an int. */
       for (i = 1; i < len; i++)
       {
          /* We start at 1 since first char has already been checked. */
-         if (!isdigit((int) val[i]))
+         if (!isdigit((unsigned char)val[i]))
          {
             is_int = SLP_FALSE;
             break;
diff -ruN openslp-2.0.0.orig/slpd/slpd_knownda.c openslp-2.0.0/slpd/slpd_knownda.c
--- openslp-2.0.0.orig/slpd/slpd_knownda.c	2012-12-11 00:31:53.000000000 +0100
+++ openslp-2.0.0/slpd/slpd_knownda.c	2017-06-10 01:16:39.074878034 +0200
@@ -488,7 +488,7 @@
    *ctx.scopelist = 0;
    ctx.addrlistlen = 0;
 
-   DHCPGetOptionInfo(dhcpOpts, sizeof(dhcpOpts), DHCPParseSLPTags, &ctx);
+   slp_DHCPGetOptionInfo(dhcpOpts, sizeof(dhcpOpts), slp_DHCPParseSLPTags, &ctx);
 
    alp = ctx.addrlist;
    while (ctx.addrlistlen >= 4)
diff -ruN openslp-2.0.0.orig/slpd/slpd_main.c openslp-2.0.0/slpd/slpd_main.c
--- openslp-2.0.0.orig/slpd/slpd_main.c	2012-12-11 00:31:53.000000000 +0100
+++ openslp-2.0.0/slpd/slpd_main.c	2017-06-10 01:16:39.074878034 +0200
@@ -358,10 +358,11 @@
    if (fd)
    {
       memset(pidstr,0,14);
-      (void)fread(pidstr,13,1,fd);
-      pid = atoi(pidstr);
-      if (pid && kill(pid, 0) == 0)
-         return -1;  /* we are already running */
+      if (fread(pidstr,13,1,fd) > 0) {
+         pid = atoi(pidstr);
+         if (pid && kill(pid, 0) == 0)
+            return -1;  /* we are already running */
+      }
       fclose(fd);
    }
    return 0;
@@ -449,7 +450,8 @@
       int i;
 
       /* change directory to root */
-      (void)chdir("/");
+      if (chdir("/") != 0)
+         ; /* TODO: ... */
 
       /* close all open file handles */
       for (i = 0; i < 8192; i++)
diff -ruN openslp-2.0.0.orig/slpd/slpd_predicate.c openslp-2.0.0/slpd/slpd_predicate.c
--- openslp-2.0.0.orig/slpd/slpd_predicate.c	2012-12-11 00:31:53.000000000 +0100
+++ openslp-2.0.0/slpd/slpd_predicate.c	2017-06-10 01:16:39.075878034 +0200
@@ -161,7 +161,7 @@
       /* Verify escape sequences. */
       if (seq_pos == 1 || seq_pos == 2)
       {
-         if (!isxdigit((int) escaped[i]))
+         if (!isxdigit((unsigned char)escaped[i]))
             return 0;
 
          if (seq_pos == 2)
@@ -198,7 +198,7 @@
  */
 static int unescape_check(char d1, char d2, char * val) 
 {
-   if (!isxdigit((int) d1) || !isxdigit((int) d2))
+   if (!isxdigit((unsigned char)d1) || !isxdigit((unsigned char)d2))
       return 0;
 
    if ((d1 >= 'A') && (d1 <= 'F'))
@@ -285,10 +285,10 @@
 
       if (unesc != verbatim[ver_i])        /* quick check for equality*/
       {
-         if (!isascii(unesc)         /* case insensitive check */
-               || !isalpha(unesc)
-               || !isalpha(verbatim[ver_i])
-               || tolower(unesc) != tolower(verbatim[ver_i]))
+         if (!isascii((unsigned char)unesc)         /* case insensitive check */
+               || !isalpha((unsigned char)unesc)
+               || !isalpha((unsigned char)verbatim[ver_i])
+               || tolower((unsigned char)unesc) != tolower((unsigned char)verbatim[ver_i]))
             return FR_EVAL_FALSE;
       }
 
@@ -866,7 +866,7 @@
    int i;
 
    for (i = 0; str[i] != 0; i++)
-      if (!((!isdigit((int) str[i])) || str[i] == '-'))
+      if (!((!isdigit((unsigned char)str[i])) || str[i] == '-'))
          return 0;
 
    return 1;