Explorar o código

libdpkg: Rename varbufsubstc() to varbuf_map_char()

Make the varbuf API a bit more consistent.
Guillem Jover %!s(int64=15) %!d(string=hai) anos
pai
achega
d5c59894cc
Modificáronse 5 ficheiros con 7 adicións e 7 borrados
  1. 1 1
      lib/dpkg/libdpkg.Versions
  2. 1 1
      lib/dpkg/log.c
  3. 3 3
      lib/dpkg/test/t-varbuf.c
  4. 1 1
      lib/dpkg/varbuf.c
  5. 1 1
      lib/dpkg/varbuf.h

+ 1 - 1
lib/dpkg/libdpkg.Versions

@@ -57,7 +57,7 @@ LIBDPKG_PRIVATE {
 	varbuf_trunc;
 	varbufaddc;
 	varbufdupc;
-	varbufsubstc;
+	varbuf_map_char;
 	varbufaddbuf;
 	varbufprintf;
 	varbufvprintf;

+ 1 - 1
lib/dpkg/log.c

@@ -106,7 +106,7 @@ statusfd_send(const char *fmt, ...)
 	varbufvprintf(&vb, fmt, args);
 	/* Sanitize string to not include new lines, as front-ends should be
 	 * doing their own word-wrapping. */
-	varbufsubstc(&vb, '\n', ' ');
+	varbuf_map_char(&vb, '\n', ' ');
 	varbufaddc(&vb, '\n');
 	va_end(args);
 

+ 3 - 3
lib/dpkg/test/t-varbuf.c

@@ -182,7 +182,7 @@ test_varbuf_dupc(void)
 }
 
 static void
-test_varbuf_substc(void)
+test_varbuf_map_char(void)
 {
 	struct varbuf vb;
 
@@ -190,7 +190,7 @@ test_varbuf_substc(void)
 
 	varbufaddbuf(&vb, "1234a5678a9012a", 15);
 
-	varbufsubstc(&vb, 'a', 'z');
+	varbuf_map_char(&vb, 'a', 'z');
 	test_pass(vb.used == 15);
 	test_pass(vb.size >= vb.used);
 	test_mem(vb.buf, ==, "1234z5678z9012z", 15);
@@ -276,7 +276,7 @@ test(void)
 	test_varbuf_addbuf();
 	test_varbuf_addc();
 	test_varbuf_dupc();
-	test_varbuf_substc();
+	test_varbuf_map_char();
 	test_varbuf_printf();
 	test_varbuf_reset();
 	test_varbuf_detach();

+ 1 - 1
lib/dpkg/varbuf.c

@@ -46,7 +46,7 @@ varbufdupc(struct varbuf *v, int c, size_t n)
 }
 
 void
-varbufsubstc(struct varbuf *v, int c_src, int c_dst)
+varbuf_map_char(struct varbuf *v, int c_src, int c_dst)
 {
   size_t i;
 

+ 1 - 1
lib/dpkg/varbuf.h

@@ -73,7 +73,7 @@ void varbuf_destroy(struct varbuf *v);
 
 void varbufaddc(struct varbuf *v, int c);
 void varbufdupc(struct varbuf *v, int c, size_t n);
-void varbufsubstc(struct varbuf *v, int c_src, int c_dst);
+void varbuf_map_char(struct varbuf *v, int c_src, int c_dst);
 #define varbufaddstr(v, s) varbufaddbuf(v, s, strlen(s))
 void varbufaddbuf(struct varbuf *v, const void *s, size_t size);