[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] hex_encode is obsoleted by base16_encode, and never actuall...



Update of /home/or/cvsroot/src/common
In directory moria.mit.edu:/tmp/cvs-serv13014/src/common

Modified Files:
	util.c util.h 
Log Message:
hex_encode is obsoleted by base16_encode, and never actually worked in the first place.  (Thanks to Timo Lindfors for noticing the never-actually-worked part.)

Index: util.c
===================================================================
RCS file: /home/or/cvsroot/src/common/util.c,v
retrieving revision 1.119
retrieving revision 1.120
diff -u -d -r1.119 -r1.120
--- util.c	4 Aug 2004 01:11:15 -0000	1.119
+++ util.c	7 Aug 2004 01:03:32 -0000	1.120
@@ -234,22 +234,6 @@
 }
 #endif
 
-/** Encode the first <b>fromlen</b> bytes stored at <b>from</b> in hexidecimal;
- * write the result as a NUL-terminated string to <b>to</b>.  <b>to</b> must
- * have at least (2*fromlen)+1 bytes of free space.
- */
-void hex_encode(const char *from, int fromlen, char *to)
-{
-  const unsigned char *fp = from;
-  static const char TABLE[] = "0123456789abcdef";
-  tor_assert(from && fromlen>=0 && to);
-  while (fromlen--) {
-    *to++ = TABLE[*fp >> 4];
-    *to++ = TABLE[*fp & 7];
-    ++fp;
-  }
-  *to = '\0';
-}
 
 /** Return a pointer to a NUL-terminated hexidecimal string encoding
  * the first <b>fromlen</b> bytes of <b>from</b>. (fromlen must be \<= 32.) The
@@ -261,7 +245,7 @@
   static char buf[65];
   if (fromlen>(sizeof(buf)-1)/2)
     fromlen = (sizeof(buf)-1)/2;
-  hex_encode(from,fromlen,buf);
+  base16_encode(buf,64,from,fromlen);
   return buf;
 }
 

Index: util.h
===================================================================
RCS file: /home/or/cvsroot/src/common/util.h,v
retrieving revision 1.77
retrieving revision 1.78
diff -u -d -r1.77 -r1.78
--- util.h	4 Aug 2004 01:11:15 -0000	1.77
+++ util.h	7 Aug 2004 01:03:32 -0000	1.78
@@ -133,7 +133,6 @@
 #endif
 #endif
 
-void hex_encode(const char *from, int fromlen, char *to);
 const char *hex_str(const char *from, int fromlen);
 
 /** Generic resizeable array. */