Valery V. Vorotyntsev (vorotylo) wrote,
Valery V. Vorotyntsev
vorotylo

diff -p

Только что заметил, что git diff показывает имена функций в hunk headers (строки с @@). Весьма удобно.

Выглядит это так:

diff --git a/main/rg-4.9.2/rg/pkg/cwmp/conf.c b/main/rg-4.9.2/rg/pkg/cwmp/conf.c
index 6659f85..d449079 100644
--- a/main/rg-4.9.2/rg/pkg/cwmp/conf.c
+++ b/main/rg-4.9.2/rg/pkg/cwmp/conf.c
@@ -17,6 +17,12 @@
 #include <stdarg.h>
 #include <assert.h>

+#ifdef W40
+#  define MODEM_TYPE "ncm_eth"
+#else
+#  define MODEM_TYPE "sierra_net"
+#endif
+
 static inline int
 obscured(const char *s)
 {
@@ -45,7 +51,7 @@ _get(const char *car, const char *cdr)
        if ((s = _value(t, cdr)) != NULL)
                s = strdup(s);

-       free(t);
+       set_free(&t);
        return s;
 }

@@ -117,7 +123,7 @@ _sip(set_t **parent)
                rv = set_get(rv, Ssip);

        if (rv == NULL) {
-               free(*parent);
+               set_free(parent);
                *parent = NULL;
        }
        return rv;
@@ -134,7 +140,7 @@ get_sip(const char *path)
            && (res = _value(*t, path)) != NULL)
                res = strdup(res);

-       free(p);
+       set_free(&p);
        return res;
 }

Подобное можно вытрясти и из subversion:  svn diff -x -up

Заодно что-то новое о diff узнал:

    `-F REGEXP'
    `--show-function-line=REGEXP'
         In context and unified format, for each hunk of differences, show
         some of the last preceding line that matches REGEXP.  Uses grep
         syntax.  *Note Specified Headings::.

Have fun!

Tags: c, tips
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

  • 0 comments