From: Josh Triplett <josh@joshtriplett.org>
To: grub-devel@gnu.org
Subject: [PATCH] Add grub_dcprintf for continuations without file/line
Date: Sat, 24 Jul 2010 20:09:53 -0700 [thread overview]
Message-ID: <20100725030948.GA25314@feather> (raw)
[-- Attachment #1: Type: text/plain, Size: 576 bytes --]
The attached patch adds a new variant of grub_dprintf, grub_dcprintf,
which avoids printing the __FILE__:__LINE__: prefix. This allows
printing a single line with multiple print statements; for instance:
grub_dprintf("some_module", "Thingy: ");
print_complicated_thingy(thingy);
grub_dcprintf("some_module", ", more details here\n");
Without the dcprintf variant, this line will contain three different
file/line prefixes.
I also added support for a "no-file-line" token in the debug environment
variable, which turns off the file/line prefixes entirely.
- Josh Triplett
[-- Attachment #2: grub-dprintf-no-file-line.patch --]
[-- Type: text/x-diff, Size: 1107 bytes --]
=== modified file 'include/grub/misc.h'
--- include/grub/misc.h 2010-07-02 17:35:07 +0000
+++ include/grub/misc.h 2010-07-24 21:33:29 +0000
@@ -47,6 +47,8 @@
#define COMPILE_TIME_ASSERT(cond) switch (0) { case 1: case !(cond): ; }
#define grub_dprintf(condition, fmt, args...) grub_real_dprintf(GRUB_FILE, __LINE__, condition, fmt, ## args)
+/* A "continuation" variant of dprintf which doesn't print file and line. */
+#define grub_dcprintf(condition, fmt, args...) grub_real_dprintf(0, 0, condition, fmt, ## args)
/* XXX: If grub_memmove is too slow, we must implement grub_memcpy. */
#define grub_memcpy(d,s,n) grub_memmove ((d), (s), (n))
=== modified file 'kern/misc.c'
--- kern/misc.c 2010-07-02 17:35:07 +0000
+++ kern/misc.c 2010-07-24 21:17:37 +0000
@@ -180,7 +180,8 @@
if (grub_strword (debug, "all") || grub_strword (debug, condition))
{
- grub_printf ("%s:%d: ", file, line);
+ if (line != 0 && !grub_strword (debug, "no-file-line"))
+ grub_printf ("%s:%d: ", file, line);
va_start (args, fmt);
grub_vprintf (fmt, args);
va_end (args);
next reply other threads:[~2010-07-25 3:13 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-25 3:09 Josh Triplett [this message]
2010-07-28 14:42 ` [PATCH] Add grub_dcprintf for continuations without file/line Vladimir 'φ-coder/phcoder' Serbinenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100725030948.GA25314@feather \
--to=josh@joshtriplett.org \
--cc=grub-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.