• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
Keine Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Commit MetaInfo

Revisione966cf302aa3b7fc0748d5cdb510d2757bbff4a5 (tree)
Zeit2021-08-09 10:36:58
Autormirabilos <m@mirb...>
Commitermirabilos

Log Message

make {en,de}code_dotted into macros

they merely call dn_{comp,expand} slightly rearranging the arguments

Signed-off-by: mirabilos <mirabilos@evolvis.org>

Ändern Zusammenfassung

Diff

--- a/libc/inet/Makefile.in
+++ b/libc/inet/Makefile.in
@@ -26,7 +26,7 @@ CSRC-$(V4_OR_V6) += \
2626 inet_lnaof.c inet_netof.c
2727 # multi source resolv.c
2828 CSRC-$(V4_OR_V6) += \
29- encodeh.c decodeh.c encoded.c decoded.c \
29+ encodeh.c decodeh.c \
3030 encodeq.c encodea.c \
3131 read_etc_hosts_r.c \
3232 dnslookup.c opennameservers.c closenameservers.c \
--- a/libc/inet/decoded.c
+++ /dev/null
@@ -1,8 +0,0 @@
1-/*
2- * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
3- *
4- * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
5- */
6-
7-#define L_decoded
8-#include RESOLVER
--- a/libc/inet/encoded.c
+++ /dev/null
@@ -1,8 +0,0 @@
1-/*
2- * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
3- *
4- * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
5- */
6-
7-#define L_encoded
8-#include RESOLVER
--- a/libc/inet/resolv.c
+++ b/libc/inet/resolv.c
@@ -396,14 +396,6 @@ extern int __dns_lookup(const char *name,
396396 int type,
397397 unsigned char **outpacket,
398398 struct resolv_answer *a) attribute_hidden;
399-extern int __encode_dotted(const char *dotted,
400- unsigned char *dest,
401- int maxlen) attribute_hidden;
402-extern int __decode_dotted(const unsigned char *packet,
403- int offset,
404- int packet_len,
405- char *dest,
406- int dest_len) attribute_hidden;
407399 extern int __encode_header(struct resolv_header *h,
408400 unsigned char *dest,
409401 int maxlen) attribute_hidden;
@@ -418,6 +410,12 @@ extern int __encode_answer(struct resolv_answer *a,
418410 extern void __open_nameservers(void) attribute_hidden;
419411 extern void __close_nameservers(void) attribute_hidden;
420412
413+#define __encode_dotted(dotted,dest,maxlen) \
414+ dn_comp((dotted), (dest), (maxlen), NULL, NULL)
415+#define __decode_dotted(packet,offset,packet_len,dest,dest_len) \
416+ dn_expand((packet), (packet) + (packet_len), (packet) + (offset), \
417+ (dest), (dest_len))
418+
421419 /*
422420 * Theory of operation.
423421 *
@@ -553,33 +551,6 @@ void __decode_header(unsigned char *data,
553551 #endif /* L_decodeh */
554552
555553
556-#ifdef L_encoded
557-
558-/* Encode a dotted string into nameserver transport-level encoding.
559- This routine is fairly dumb, and doesn't attempt to compress
560- the data */
561-int __encode_dotted(const char *dotted, unsigned char *dest, int maxlen)
562-{
563- return (dn_comp(dotted, dest, maxlen, NULL, NULL));
564-}
565-#endif /* L_encoded */
566-
567-
568-#ifdef L_decoded
569-
570-/* Decode a dotted string from nameserver transport-level encoding.
571- This routine understands compressed data. */
572-int __decode_dotted(const unsigned char *packet,
573- int offset,
574- int packet_len,
575- char *dest,
576- int dest_len)
577-{
578- return (dn_expand(packet, packet + packet_len, packet + offset, dest, dest_len));
579-}
580-#endif /* L_decoded */
581-
582-
583554 #ifdef L_encodeq
584555
585556 int __encode_question(const struct resolv_question *q,