Undo one of my memory optimization hacks - it actually made things more
complicated.
This commit is contained in:
parent
29d7f1c318
commit
61be8f66cf
@ -4,7 +4,7 @@
|
||||
* This is probably the last attempt in the `sysinstall' line, the next
|
||||
* generation being slated to essentially a complete rewrite.
|
||||
*
|
||||
* $Id: attr.c,v 1.10 1996/12/11 09:34:53 jkh Exp $
|
||||
* $Id: attr.c,v 1.11 1996/12/11 18:23:16 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
@ -137,23 +137,23 @@ attr_parse(Attribs *attr, FILE *fp)
|
||||
break;
|
||||
|
||||
case COMMIT:
|
||||
attr[num_attribs].name = strdup(hold_n);
|
||||
attr[num_attribs].value = strdup(hold_v);
|
||||
SAFE_STRCPY(attr[num_attribs].name, hold_n);
|
||||
SAFE_STRCPY(attr[num_attribs].value, hold_v);
|
||||
state = LOOK;
|
||||
v = n = 0;
|
||||
if (++num_attribs >= MAX_ATTRIBS)
|
||||
msgFatal("Attribute limit overflow; encountered a bad attributes file!");
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
msgFatal("Unknown state at line %d??", lno);
|
||||
}
|
||||
}
|
||||
attr[num_attribs].name = NULL; /* end marker */
|
||||
attr[num_attribs].value = NULL; /* end marker */
|
||||
attr[num_attribs].name[0] = NULL; /* end marker */
|
||||
attr[num_attribs].value[0] = NULL; /* end marker */
|
||||
if (isDebug())
|
||||
msgDebug("Finished parsing %d attributes.\n", num_attribs);
|
||||
|
||||
|
||||
return DITEM_SUCCESS;
|
||||
}
|
||||
|
||||
@ -165,7 +165,7 @@ attr_match(Attribs *attr, char *name)
|
||||
if (isDebug())
|
||||
msgDebug("Trying to match attribute `%s'\n", name);
|
||||
|
||||
for (n = 0; attr[n].name && strcasecmp(attr[n].name, name) != 0; n++) {
|
||||
for (n = 0; attr[n].name[0] && strcasecmp(attr[n].name, name) != 0; n++) {
|
||||
if (isDebug())
|
||||
msgDebug("Skipping attribute %u\n", n);
|
||||
}
|
||||
@ -173,7 +173,7 @@ attr_match(Attribs *attr, char *name)
|
||||
if (isDebug())
|
||||
msgDebug("Stopped on attribute %u\n", n);
|
||||
|
||||
if (attr[n].name) {
|
||||
if (attr[n].name[0]) {
|
||||
if (isDebug())
|
||||
msgDebug("Returning `%s'\n", attr[n].value);
|
||||
return(attr[n].value);
|
||||
@ -181,16 +181,3 @@ attr_match(Attribs *attr, char *name)
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void
|
||||
attr_free(Attribs *attr)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; attr[i].name; i++) {
|
||||
free(attr[i].name);
|
||||
free(attr[i].value);
|
||||
attr[i].name = attr[i].value = NULL;
|
||||
}
|
||||
free(attr);
|
||||
}
|
||||
|
@ -4,7 +4,7 @@
|
||||
* This is probably the last attempt in the `sysinstall' line, the next
|
||||
* generation being slated to essentially a complete rewrite.
|
||||
*
|
||||
* $Id: cdrom.c,v 1.27 1996/12/11 09:34:54 jkh Exp $
|
||||
* $Id: cdrom.c,v 1.28 1996/12/11 18:23:16 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
@ -74,7 +74,7 @@ mediaInitCDROM(Device *dev)
|
||||
args.fspec = dev->devname;
|
||||
args.flags = 0;
|
||||
|
||||
cd_attr = safe_malloc(sizeof(Attribs) * MAX_ATTRIBS);
|
||||
cd_attr = alloca(sizeof(Attribs) * MAX_ATTRIBS);
|
||||
cp = NULL;
|
||||
dontRead = FALSE;
|
||||
/* If this cdrom's not already mounted or can't be mounted, yell */
|
||||
@ -116,7 +116,6 @@ mediaInitCDROM(Device *dev)
|
||||
"to set the boot floppy version string to match that of the CD\n"
|
||||
"before selecting it as an installation media to avoid this warning", cp, variable_get(VAR_RELNAME));
|
||||
}
|
||||
attr_free(cd_attr);
|
||||
msgDebug("Mounted FreeBSD CDROM on device %s as /cdrom\n", dev->devname);
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -4,7 +4,7 @@
|
||||
* This is probably the last program in the `sysinstall' line - the next
|
||||
* generation being essentially a complete rewrite.
|
||||
*
|
||||
* $Id: dist.c,v 1.81 1996/12/11 09:34:57 jkh Exp $
|
||||
* $Id: dist.c,v 1.82 1996/12/11 18:23:17 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
@ -389,7 +389,7 @@ distExtract(char *parent, Distribution *me)
|
||||
if (fp > 0) {
|
||||
if (isDebug())
|
||||
msgDebug("Parsing attributes file for distribution %s\n", dist);
|
||||
dist_attr = safe_malloc(sizeof(Attribs) * MAX_ATTRIBS);
|
||||
dist_attr = alloca(sizeof(Attribs) * MAX_ATTRIBS);
|
||||
if (DITEM_STATUS(attr_parse(dist_attr, fp)) == DITEM_FAILURE)
|
||||
msgConfirm("Cannot parse information file for the %s distribution!\n"
|
||||
"Please verify that your media is valid and try again.", dist);
|
||||
@ -400,7 +400,6 @@ distExtract(char *parent, Distribution *me)
|
||||
if (tmp)
|
||||
numchunks = strtol(tmp, 0, 0);
|
||||
}
|
||||
attr_free(dist_attr);
|
||||
fclose(fp);
|
||||
if (!numchunks)
|
||||
continue;
|
||||
|
@ -4,7 +4,7 @@
|
||||
* This is probably the last attempt in the `sysinstall' line, the next
|
||||
* generation being slated for what's essentially a complete rewrite.
|
||||
*
|
||||
* $Id: main.c,v 1.30 1996/12/11 18:23:17 jkh Exp $
|
||||
* $Id: main.c,v 1.31 1996/12/12 08:23:49 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
@ -119,7 +119,7 @@ main(int argc, char **argv)
|
||||
FILE *fp;
|
||||
Attribs *attrs;
|
||||
|
||||
attrs = safe_malloc(sizeof(Attribs) * MAX_ATTRIBS);
|
||||
attrs = alloca(sizeof(Attribs) * MAX_ATTRIBS);
|
||||
fp = fopen("install.cfg", "r");
|
||||
if (fp) {
|
||||
msgNotify("Loading pre-configuration file");
|
||||
@ -130,7 +130,6 @@ main(int argc, char **argv)
|
||||
variable_set2(attrs[i].name, attrs[i].value);
|
||||
}
|
||||
fclose(fp);
|
||||
attr_free(attrs);
|
||||
}
|
||||
|
||||
#if defined(LOAD_CONFIG_FILE)
|
||||
@ -158,7 +157,6 @@ main(int argc, char **argv)
|
||||
variable_set2(attrs[i].name, attrs[i].value);
|
||||
}
|
||||
fclose(fp);
|
||||
attr_free(attrs);
|
||||
}
|
||||
mediaDevice->shutdown(mediaDevice);
|
||||
}
|
||||
|
@ -4,7 +4,7 @@
|
||||
* This is probably the last attempt in the `sysinstall' line, the next
|
||||
* generation being slated to essentially a complete rewrite.
|
||||
*
|
||||
* $Id: sysinstall.h,v 1.91 1996/12/11 09:35:05 jkh Exp $
|
||||
* $Id: sysinstall.h,v 1.92 1996/12/11 18:23:19 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
@ -179,8 +179,8 @@ typedef struct _variable {
|
||||
#define MAX_VALUE 256
|
||||
|
||||
typedef struct _attribs {
|
||||
char *name;
|
||||
char *value;
|
||||
char name[MAX_NAME];
|
||||
char value[MAX_VALUE];
|
||||
} Attribs;
|
||||
|
||||
typedef enum {
|
||||
@ -211,7 +211,6 @@ typedef struct _device {
|
||||
Boolean enabled;
|
||||
Boolean (*init)(struct _device *dev);
|
||||
FILE * (*get)(struct _device *dev, char *file, Boolean probe);
|
||||
Boolean (*close)(struct _device *dev, FILE *fp);
|
||||
void (*shutdown)(struct _device *dev);
|
||||
void *private;
|
||||
unsigned int flags;
|
||||
@ -355,7 +354,6 @@ extern int configAnonFTP(dialogMenuItem *self);
|
||||
extern char *attr_match(Attribs *attr, char *name);
|
||||
extern int attr_parse_file(Attribs *attr, char *file);
|
||||
extern int attr_parse(Attribs *attr, FILE *fp);
|
||||
extern void attr_free(Attribs *attr);
|
||||
|
||||
/* cdrom.c */
|
||||
extern Boolean mediaInitCDROM(Device *dev);
|
||||
|
@ -4,7 +4,7 @@
|
||||
* This is probably the last attempt in the `sysinstall' line, the next
|
||||
* generation being slated for what's essentially a complete rewrite.
|
||||
*
|
||||
* $Id: main.c,v 1.30 1996/12/11 18:23:17 jkh Exp $
|
||||
* $Id: main.c,v 1.31 1996/12/12 08:23:49 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
@ -119,7 +119,7 @@ main(int argc, char **argv)
|
||||
FILE *fp;
|
||||
Attribs *attrs;
|
||||
|
||||
attrs = safe_malloc(sizeof(Attribs) * MAX_ATTRIBS);
|
||||
attrs = alloca(sizeof(Attribs) * MAX_ATTRIBS);
|
||||
fp = fopen("install.cfg", "r");
|
||||
if (fp) {
|
||||
msgNotify("Loading pre-configuration file");
|
||||
@ -130,7 +130,6 @@ main(int argc, char **argv)
|
||||
variable_set2(attrs[i].name, attrs[i].value);
|
||||
}
|
||||
fclose(fp);
|
||||
attr_free(attrs);
|
||||
}
|
||||
|
||||
#if defined(LOAD_CONFIG_FILE)
|
||||
@ -158,7 +157,6 @@ main(int argc, char **argv)
|
||||
variable_set2(attrs[i].name, attrs[i].value);
|
||||
}
|
||||
fclose(fp);
|
||||
attr_free(attrs);
|
||||
}
|
||||
mediaDevice->shutdown(mediaDevice);
|
||||
}
|
||||
|
@ -4,7 +4,7 @@
|
||||
* This is probably the last attempt in the `sysinstall' line, the next
|
||||
* generation being slated to essentially a complete rewrite.
|
||||
*
|
||||
* $Id: sysinstall.h,v 1.91 1996/12/11 09:35:05 jkh Exp $
|
||||
* $Id: sysinstall.h,v 1.92 1996/12/11 18:23:19 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
@ -179,8 +179,8 @@ typedef struct _variable {
|
||||
#define MAX_VALUE 256
|
||||
|
||||
typedef struct _attribs {
|
||||
char *name;
|
||||
char *value;
|
||||
char name[MAX_NAME];
|
||||
char value[MAX_VALUE];
|
||||
} Attribs;
|
||||
|
||||
typedef enum {
|
||||
@ -211,7 +211,6 @@ typedef struct _device {
|
||||
Boolean enabled;
|
||||
Boolean (*init)(struct _device *dev);
|
||||
FILE * (*get)(struct _device *dev, char *file, Boolean probe);
|
||||
Boolean (*close)(struct _device *dev, FILE *fp);
|
||||
void (*shutdown)(struct _device *dev);
|
||||
void *private;
|
||||
unsigned int flags;
|
||||
@ -355,7 +354,6 @@ extern int configAnonFTP(dialogMenuItem *self);
|
||||
extern char *attr_match(Attribs *attr, char *name);
|
||||
extern int attr_parse_file(Attribs *attr, char *file);
|
||||
extern int attr_parse(Attribs *attr, FILE *fp);
|
||||
extern void attr_free(Attribs *attr);
|
||||
|
||||
/* cdrom.c */
|
||||
extern Boolean mediaInitCDROM(Device *dev);
|
||||
|
@ -4,7 +4,7 @@
|
||||
* This is probably the last attempt in the `sysinstall' line, the next
|
||||
* generation being slated to essentially a complete rewrite.
|
||||
*
|
||||
* $Id: cdrom.c,v 1.27 1996/12/11 09:34:54 jkh Exp $
|
||||
* $Id: cdrom.c,v 1.28 1996/12/11 18:23:16 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
@ -74,7 +74,7 @@ mediaInitCDROM(Device *dev)
|
||||
args.fspec = dev->devname;
|
||||
args.flags = 0;
|
||||
|
||||
cd_attr = safe_malloc(sizeof(Attribs) * MAX_ATTRIBS);
|
||||
cd_attr = alloca(sizeof(Attribs) * MAX_ATTRIBS);
|
||||
cp = NULL;
|
||||
dontRead = FALSE;
|
||||
/* If this cdrom's not already mounted or can't be mounted, yell */
|
||||
@ -116,7 +116,6 @@ mediaInitCDROM(Device *dev)
|
||||
"to set the boot floppy version string to match that of the CD\n"
|
||||
"before selecting it as an installation media to avoid this warning", cp, variable_get(VAR_RELNAME));
|
||||
}
|
||||
attr_free(cd_attr);
|
||||
msgDebug("Mounted FreeBSD CDROM on device %s as /cdrom\n", dev->devname);
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -4,7 +4,7 @@
|
||||
* This is probably the last program in the `sysinstall' line - the next
|
||||
* generation being essentially a complete rewrite.
|
||||
*
|
||||
* $Id: dist.c,v 1.81 1996/12/11 09:34:57 jkh Exp $
|
||||
* $Id: dist.c,v 1.82 1996/12/11 18:23:17 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
@ -389,7 +389,7 @@ distExtract(char *parent, Distribution *me)
|
||||
if (fp > 0) {
|
||||
if (isDebug())
|
||||
msgDebug("Parsing attributes file for distribution %s\n", dist);
|
||||
dist_attr = safe_malloc(sizeof(Attribs) * MAX_ATTRIBS);
|
||||
dist_attr = alloca(sizeof(Attribs) * MAX_ATTRIBS);
|
||||
if (DITEM_STATUS(attr_parse(dist_attr, fp)) == DITEM_FAILURE)
|
||||
msgConfirm("Cannot parse information file for the %s distribution!\n"
|
||||
"Please verify that your media is valid and try again.", dist);
|
||||
@ -400,7 +400,6 @@ distExtract(char *parent, Distribution *me)
|
||||
if (tmp)
|
||||
numchunks = strtol(tmp, 0, 0);
|
||||
}
|
||||
attr_free(dist_attr);
|
||||
fclose(fp);
|
||||
if (!numchunks)
|
||||
continue;
|
||||
|
@ -4,7 +4,7 @@
|
||||
* This is probably the last attempt in the `sysinstall' line, the next
|
||||
* generation being slated for what's essentially a complete rewrite.
|
||||
*
|
||||
* $Id: main.c,v 1.30 1996/12/11 18:23:17 jkh Exp $
|
||||
* $Id: main.c,v 1.31 1996/12/12 08:23:49 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
@ -119,7 +119,7 @@ main(int argc, char **argv)
|
||||
FILE *fp;
|
||||
Attribs *attrs;
|
||||
|
||||
attrs = safe_malloc(sizeof(Attribs) * MAX_ATTRIBS);
|
||||
attrs = alloca(sizeof(Attribs) * MAX_ATTRIBS);
|
||||
fp = fopen("install.cfg", "r");
|
||||
if (fp) {
|
||||
msgNotify("Loading pre-configuration file");
|
||||
@ -130,7 +130,6 @@ main(int argc, char **argv)
|
||||
variable_set2(attrs[i].name, attrs[i].value);
|
||||
}
|
||||
fclose(fp);
|
||||
attr_free(attrs);
|
||||
}
|
||||
|
||||
#if defined(LOAD_CONFIG_FILE)
|
||||
@ -158,7 +157,6 @@ main(int argc, char **argv)
|
||||
variable_set2(attrs[i].name, attrs[i].value);
|
||||
}
|
||||
fclose(fp);
|
||||
attr_free(attrs);
|
||||
}
|
||||
mediaDevice->shutdown(mediaDevice);
|
||||
}
|
||||
|
@ -4,7 +4,7 @@
|
||||
* This is probably the last attempt in the `sysinstall' line, the next
|
||||
* generation being slated to essentially a complete rewrite.
|
||||
*
|
||||
* $Id: sysinstall.h,v 1.91 1996/12/11 09:35:05 jkh Exp $
|
||||
* $Id: sysinstall.h,v 1.92 1996/12/11 18:23:19 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
@ -179,8 +179,8 @@ typedef struct _variable {
|
||||
#define MAX_VALUE 256
|
||||
|
||||
typedef struct _attribs {
|
||||
char *name;
|
||||
char *value;
|
||||
char name[MAX_NAME];
|
||||
char value[MAX_VALUE];
|
||||
} Attribs;
|
||||
|
||||
typedef enum {
|
||||
@ -211,7 +211,6 @@ typedef struct _device {
|
||||
Boolean enabled;
|
||||
Boolean (*init)(struct _device *dev);
|
||||
FILE * (*get)(struct _device *dev, char *file, Boolean probe);
|
||||
Boolean (*close)(struct _device *dev, FILE *fp);
|
||||
void (*shutdown)(struct _device *dev);
|
||||
void *private;
|
||||
unsigned int flags;
|
||||
@ -355,7 +354,6 @@ extern int configAnonFTP(dialogMenuItem *self);
|
||||
extern char *attr_match(Attribs *attr, char *name);
|
||||
extern int attr_parse_file(Attribs *attr, char *file);
|
||||
extern int attr_parse(Attribs *attr, FILE *fp);
|
||||
extern void attr_free(Attribs *attr);
|
||||
|
||||
/* cdrom.c */
|
||||
extern Boolean mediaInitCDROM(Device *dev);
|
||||
|
Loading…
Reference in New Issue
Block a user