Просмотр исходного кода

Give better names to variables in malloc replacement functions

Guillem Jover лет назад: 12
Родитель
Сommit
4eca28c8bc
2 измененных файлов с 14 добавлено и 10 удалено
  1. 10 6
      lib/dpkg/mlib.c
  2. 4 4
      utils/update-alternatives.c

+ 10 - 6
lib/dpkg/mlib.c

@@ -44,17 +44,21 @@ must_alloc(void *ptr)
 
 void *m_malloc(size_t amount) {
 #ifdef MDEBUG
-  unsigned short *r2, x;
+  unsigned short *ptr_canary, canary;
 #endif
-  void *r;
+  void *ptr;
 
-  r = must_alloc(malloc(amount));
+  ptr = must_alloc(malloc(amount));
 
 #ifdef MDEBUG
-  r2= r; x= (unsigned short)amount ^ 0xf000;
-  while (amount >= 2) { *r2++= x; amount -= 2; }
+  ptr_canary = ptr;
+  canary = (unsigned short)amount ^ 0xf000;
+  while (amount >= 2) {
+    *ptr_canary++ = canary;
+    amount -= 2;
+  }
 #endif
-  return r;
+  return ptr;
 }
 
 void *

+ 4 - 4
utils/update-alternatives.c

@@ -252,13 +252,13 @@ pr(char const *fmt, ...)
 static void *
 xmalloc(size_t size)
 {
-	void *r;
+	void *ptr;
 
-	r = malloc(size);
-	if (!r)
+	ptr = malloc(size);
+	if (!ptr)
 		error(_("malloc failed (%zu bytes)"), size);
 
-	return r;
+	return ptr;
 }
 
 static char *