[PATCH:xman 2/4] Don't need to copy static strings to a buffer before calling PopupWarning
Alan Coopersmith
alan.coopersmith at oracle.com
Fri Jan 28 23:13:58 PST 2011
Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
---
handler.c | 12 +++++-------
misc.c | 20 ++++++++------------
2 files changed, 13 insertions(+), 19 deletions(-)
diff --git a/handler.c b/handler.c
index cf2d83a..c61bd24 100644
--- a/handler.c
+++ b/handler.c
@@ -361,9 +361,8 @@ SaveFormattedPage(Widget w, XEvent * event, String * params, Cardinal * num_para
case 'c':
break;
default:
- sprintf(error_buf,"%s %s", "Xman - SaveFormattedPagee:",
- "Unknown argument must be either 'Save' or 'Cancel'.");
- PopupWarning(man_globals, error_buf);
+ PopupWarning(man_globals, "Xman - SaveFormattedPage: "
+ "Unknown argument must be either 'Save' or 'Cancel'.");
return;
}
@@ -392,7 +391,6 @@ void
GotoPage(Widget w, XEvent * event, String * params, Cardinal * num_params)
{
ManpageGlobals * man_globals;
- char error_buf[BUFSIZ];
Arg arglist[1];
Boolean sensitive;
@@ -431,9 +429,9 @@ GotoPage(Widget w, XEvent * event, String * params, Cardinal * num_params)
man_globals->dir_shown = TRUE;
break;
default:
- sprintf(error_buf,"%s %s", "Xman - GotoPage: Unknown argument must be",
- "either Manpage or Directory.");
- XtAppWarning(XtWidgetToApplicationContext(w), error_buf);
+ XtAppWarning(XtWidgetToApplicationContext(w),
+ "Xman - GotoPage: Unknown argument must be "
+ "either Manpage or Directory.");
return;
}
}
diff --git a/misc.c b/misc.c
index cc0397e..25fc70c 100644
--- a/misc.c
+++ b/misc.c
@@ -320,7 +320,7 @@ FindManualFile(ManpageGlobals * man_globals, int section_num, int entry_num)
static FILE *
Uncompress(ManpageGlobals * man_globals, char * filename)
{
- char tmp_file[BUFSIZ], error_buf[BUFSIZ];
+ char tmp_file[BUFSIZ];
FILE * file;
#ifndef HAS_MKSTEMP
@@ -328,15 +328,13 @@ Uncompress(ManpageGlobals * man_globals, char * filename)
return(NULL);
else if ((file = fopen(tmp_file, "r")) == NULL) {
- sprintf(error_buf, "Something went wrong in retrieving the %s",
- "uncompressed manual page try cleaning up /tmp.");
- PopupWarning(man_globals, error_buf);
+ PopupWarning(man_globals, "Something went wrong in retrieving the "
+ "uncompressed manual page try cleaning up /tmp.");
}
#else
if (!UncompressNamed(man_globals, filename, tmp_file, &file)) {
- sprintf(error_buf, "Something went wrong in retrieving the %s",
- "uncompressed manual page try cleaning up /tmp.");
- PopupWarning(man_globals, error_buf);
+ PopupWarning(man_globals, "Something went wrong in retrieving the "
+ "uncompressed manual page try cleaning up /tmp.");
return(NULL);
}
#endif
@@ -583,8 +581,7 @@ Format(ManpageGlobals * man_globals, char * entry)
#else
/* Handle more flexible way of specifying the formatting pipeline */
if (! ConstructCommand(cmdbuf, path, filename, man_globals->tempfile)) {
- sprintf(error_buf, "Constructed command was too long!");
- PopupWarning(man_globals, error_buf);
+ PopupWarning(man_globals, "Constructed command was too long!");
file = NULL;
}
else
@@ -599,9 +596,8 @@ Format(ManpageGlobals * man_globals, char * entry)
else {
#ifndef HAS_MKSTEMP
if ((file = fopen(man_globals->tempfile,"r")) == NULL) {
- sprintf(error_buf, "Something went wrong in retrieving the %s",
- "temp file, try cleaning up /tmp");
- PopupWarning(man_globals, error_buf);
+ PopupWarning(man_globals, "Something went wrong in retrieving the "
+ "temp file, try cleaning up /tmp");
}
else {
#endif
--
1.7.3.2
More information about the xorg-devel
mailing list