2000-08-08 Andrew V. Samoilov <sav@bcs.zp.ua>
* hotlist.c (done_hotlist): static tkn_buf, tkn_buf_length and tkn_length nullified after tkn_buf is freed to prevent crushes. (new_hotlist): became a macro * background.c (real_message_[123]s): title is really prepended by "Background process:" string now if mode == Background (background_attention): resstr NULLified to prevent warning
Этот коммит содержится в:
родитель
a1d1728dc8
Коммит
3a18921cd0
@ -1,3 +1,15 @@
|
||||
2000-08-08 Andrew V. Samoilov <sav@bcs.zp.ua>
|
||||
|
||||
* hotlist.c (done_hotlist): static tkn_buf, tkn_buf_length and
|
||||
tkn_length nullified after tkn_buf is freed to prevent crushes.
|
||||
|
||||
(new_hotlist): became a macro
|
||||
|
||||
* background.c (real_message_[123]s): title is really prepended
|
||||
by "Background process:" string now if mode == Background
|
||||
|
||||
(background_attention): resstr NULLified to prevent warning
|
||||
|
||||
2000-06-26 Andrew V. Samoilov <sav@bcs.zp.ua>
|
||||
|
||||
* screen.c (display_mini_info): two different patterns are
|
||||
|
@ -178,58 +178,44 @@ do_background (FileOpContext *ctx, char *info)
|
||||
static char *
|
||||
background_title (char *str)
|
||||
{
|
||||
char *result = g_strconcat (_("Background process:"), str, NULL);
|
||||
|
||||
return result;
|
||||
return g_strconcat (_("Background process:"), str, NULL);
|
||||
}
|
||||
|
||||
/* {{{ Routines that do the real job */
|
||||
static void
|
||||
real_message_1s (enum OperationMode mode, int *flags, char *title, char *str1)
|
||||
{
|
||||
char *full_title;
|
||||
|
||||
if (mode == Background)
|
||||
full_title = background_title (title);
|
||||
else
|
||||
full_title = title;
|
||||
title = background_title (title);
|
||||
|
||||
message (*flags, title, str1);
|
||||
|
||||
if (title != full_title)
|
||||
g_free (full_title);
|
||||
if (mode == Background)
|
||||
g_free (title);
|
||||
}
|
||||
|
||||
static void
|
||||
real_message_2s (enum OperationMode mode, int *flags, char *title, char *str1, char *str2)
|
||||
{
|
||||
char *full_title;
|
||||
|
||||
if (mode == Background)
|
||||
full_title = background_title (title);
|
||||
else
|
||||
full_title = title;
|
||||
title = background_title (title);
|
||||
|
||||
message (*flags, title, str1, str2);
|
||||
|
||||
if (title != full_title)
|
||||
g_free (full_title);
|
||||
if (mode == Background)
|
||||
g_free (title);
|
||||
}
|
||||
|
||||
static void
|
||||
real_message_3s (enum OperationMode mode, int *flags, char *title, char *str1, char *str2, const char *str3)
|
||||
{
|
||||
char *full_title;
|
||||
|
||||
if (mode == Background)
|
||||
full_title = background_title (title);
|
||||
else
|
||||
full_title = title;
|
||||
title = background_title (title);
|
||||
|
||||
message (*flags, title, str1, str2, str3);
|
||||
|
||||
if (title != full_title)
|
||||
g_free (full_title);
|
||||
if (mode == Background)
|
||||
g_free (title);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@ -281,15 +267,15 @@ background_attention (int fd, void *closure)
|
||||
void *routine;
|
||||
int argc, i, result, status;
|
||||
char *data [MAXCALLARGS];
|
||||
char *resstr;
|
||||
int bytes;
|
||||
enum ReturnType type;
|
||||
char *background_process_error = _(" Background process error ");
|
||||
|
||||
ctx = closure;
|
||||
|
||||
bytes = read (fd, &routine, sizeof (routine));
|
||||
if (bytes < (sizeof (routine))){
|
||||
char *background_process_error = _(" Background process error ");
|
||||
|
||||
if (errno == ECHILD)
|
||||
message (1, background_process_error, _(" Child died unexpectedly "));
|
||||
else
|
||||
@ -373,6 +359,7 @@ background_attention (int fd, void *closure)
|
||||
write (fd, ctx, sizeof (FileOpContext));
|
||||
} else if (type == Return_String) {
|
||||
int len;
|
||||
char *resstr = NULL;
|
||||
|
||||
/* FIXME: string routines should also use the Foreground/Background
|
||||
* parameter. Currently, this is not used here
|
||||
@ -535,7 +522,6 @@ message_3s (int flags, char *title, char *str1, char *str2, const char *str3)
|
||||
char *
|
||||
input_dialog_help (char *header, char *text, char *help, char *def_text)
|
||||
{
|
||||
extern char *real_input_dialog_help (char *header, char *text, char *help, char *def_text);
|
||||
if (we_are_background)
|
||||
return parent_call_string ((void *)real_input_dialog_help, 4,
|
||||
strlen (header), header,
|
||||
|
@ -156,20 +156,7 @@ struct hotlist *current_group;
|
||||
static void remove_from_hotlist (struct hotlist *entry);
|
||||
void add_new_group_cmd (void);
|
||||
|
||||
static struct hotlist *new_hotlist (void)
|
||||
{
|
||||
struct hotlist *hl;
|
||||
|
||||
hl = g_new (struct hotlist, 1);
|
||||
hl->type = 0;
|
||||
hl->directory =
|
||||
hl->label = 0;
|
||||
hl->head =
|
||||
hl->up =
|
||||
hl->next = 0;
|
||||
|
||||
return hl;
|
||||
}
|
||||
#define new_hotlist() g_new0(struct hotlist, 1)
|
||||
|
||||
#ifndef HAVE_X
|
||||
static void hotlist_refresh (Dlg_head *dlg)
|
||||
@ -1403,7 +1390,7 @@ void load_hotlist (void)
|
||||
load_group (hotlist);
|
||||
hotlist_state.loaded = 1;
|
||||
/*
|
||||
* just to be shure we got copy
|
||||
* just to be sure we got copy
|
||||
*/
|
||||
hotlist_state.modified = 1;
|
||||
result = save_hotlist ();
|
||||
@ -1590,7 +1577,6 @@ int save_hotlist (void)
|
||||
else
|
||||
chmod (hotlist_file_name, S_IRUSR | S_IWUSR);
|
||||
hot_save_group (hotlist);
|
||||
fflush (hotlist_file);
|
||||
fclose (hotlist_file);
|
||||
stat (hotlist_file_name, &stat_buf);
|
||||
hotlist_file_mtime = stat_buf.st_mtime;
|
||||
@ -1606,26 +1592,29 @@ int save_hotlist (void)
|
||||
|
||||
void done_hotlist (void)
|
||||
{
|
||||
if (hotlist)
|
||||
remove_group (hotlist);
|
||||
hotlist_state.loaded = 0;
|
||||
|
||||
if (hotlist){
|
||||
remove_group (hotlist);
|
||||
if (hotlist->label)
|
||||
g_free (hotlist->label);
|
||||
if (hotlist->directory)
|
||||
g_free (hotlist->directory);
|
||||
g_free (hotlist);
|
||||
hotlist = 0;
|
||||
}
|
||||
|
||||
if (hotlist_file_name)
|
||||
hotlist_state.loaded = 0;
|
||||
|
||||
if (hotlist_file_name){
|
||||
g_free (hotlist_file_name);
|
||||
hotlist_file_name = 0;
|
||||
hotlist = current_group = 0;
|
||||
hotlist_file_name = 0;
|
||||
}
|
||||
l_hotlist = 0;
|
||||
current_group = 0;
|
||||
if (tkn_buf)
|
||||
if (tkn_buf){
|
||||
g_free (tkn_buf);
|
||||
tkn_buf_length = 0;
|
||||
tkn_length = 0;
|
||||
tkn_buf = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user