[CODIFF]: Show more info in verbose mode for function diffs

Example:

Applying this patch to the linux kernel sources:

     diff --git a/include/net/xfrm.h b/include/net/xfrm.h
     index e476541..178eb50 100644
     - a/include/net/xfrm.h
     + b/include/net/xfrm.h
     @@ -853,7 +853,7 @@ struct xfrm_algo_comp_info {
      struct xfrm_algo_desc {
 	     char *name;
 	     char *compat;
     -	u8 available:1;
     +	u8 available;
 	     union {
 		     struct xfrm_algo_auth_info auth;
 		     struct xfrm_algo_encr_info encr;

We get this result:

[acme@newtoy linux-2.6]$ codiff -V /tmp/vmlinux.before vmlinux
net/xfrm/xfrm_algo.c:
  struct xfrm_algo_desc     |   +0
    available:1;
     from: u8                    /*     8(7)     1(1) */
     to:   u8                    /*     8(0)     1(0) */
 1 struct changed
  xfrm_count_auth_supported |  -15 # 42 -> 27
  xfrm_count_enc_supported  |  -15 # 42 -> 27
  xfrm_get_byname           |  -14 # 250 -> 236
  xfrm_probe_algs           | -102 # 284 -> 182
 4 functions changed, 146 bytes removed

net/xfrm/xfrm_user.c:
  struct xfrm_algo_desc |   +0
    available:1;
     from: u8                    /*     8(7)     1(1) */
     to:   u8                    /*     8(0)     1(0) */
 1 struct changed

vmlinux:
 4 functions changed, 146 bytes removed

See the info after the '#' character? old size -> new size.

Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
This commit is contained in:
Arnaldo Carvalho de Melo 2007-01-08 12:21:47 -02:00
parent d0e47a6f2c
commit 746f462b4e

View File

@ -353,9 +353,28 @@ static void show_diffs_function(struct function *function, const struct cu *cu)
{
const struct diff_info *di = function->priv;
printf(" %-*.*s | %+4d\n",
printf(" %-*.*s | %+4d",
cu->max_len_changed_item, cu->max_len_changed_item,
function__name(function, cu), di->diff);
if (!verbose) {
putchar('\n');
return;
}
if (di->tag == NULL)
puts("(null)");
else {
const struct function *twin = tag__function(di->tag);
if (strcmp(function->name, twin->name) != 0)
printf("%s: BRAIN FART ALERT: comparing %s to %s, "
"should be the same name\n", __FUNCTION__,
function->name, twin->name);
else
printf(" # %d -> %d\n", function__size(function),
function__size(twin));
}
}
static void show_changed_member(char change, const struct class_member *member,