kill perror("malloc") since we already have a good error messages
This commit is contained in:
10
parse.yacc
10
parse.yacc
@@ -93,7 +93,6 @@ int top = 0, stacksize = 0;
|
|||||||
while ((stacksize += STACKINCREMENT) < top); \
|
while ((stacksize += STACKINCREMENT) < top); \
|
||||||
match = (struct matchstack *) realloc(match, sizeof(struct matchstack) * stacksize); \
|
match = (struct matchstack *) realloc(match, sizeof(struct matchstack) * stacksize); \
|
||||||
if (match == NULL) { \
|
if (match == NULL) { \
|
||||||
perror("malloc"); \
|
|
||||||
(void) fprintf(stderr, "%s: cannot allocate memory!\n", Argv[0]); \
|
(void) fprintf(stderr, "%s: cannot allocate memory!\n", Argv[0]); \
|
||||||
exit(1); \
|
exit(1); \
|
||||||
} \
|
} \
|
||||||
@@ -511,7 +510,6 @@ cmndalias : ALIAS {
|
|||||||
/* Allocate space for ga_list if necesary. */
|
/* Allocate space for ga_list if necesary. */
|
||||||
expand_ga_list();
|
expand_ga_list();
|
||||||
if (!(ga_list[ga_list_len-1].alias = strdup($1))){
|
if (!(ga_list[ga_list_len-1].alias = strdup($1))){
|
||||||
perror("malloc");
|
|
||||||
(void) fprintf(stderr,
|
(void) fprintf(stderr,
|
||||||
"%s: cannot allocate memory!\n", Argv[0]);
|
"%s: cannot allocate memory!\n", Argv[0]);
|
||||||
exit(1);
|
exit(1);
|
||||||
@@ -545,7 +543,6 @@ runasalias : ALIAS {
|
|||||||
/* Allocate space for ga_list if necesary. */
|
/* Allocate space for ga_list if necesary. */
|
||||||
expand_ga_list();
|
expand_ga_list();
|
||||||
if (!(ga_list[ga_list_len-1].alias = strdup($1))){
|
if (!(ga_list[ga_list_len-1].alias = strdup($1))){
|
||||||
perror("malloc");
|
|
||||||
(void) fprintf(stderr,
|
(void) fprintf(stderr,
|
||||||
"%s: cannot allocate memory!\n", Argv[0]);
|
"%s: cannot allocate memory!\n", Argv[0]);
|
||||||
exit(1);
|
exit(1);
|
||||||
@@ -870,7 +867,6 @@ static void append(src, dstp, dst_len, dst_size, separator)
|
|||||||
/* Assumes dst will be NULL if not set. */
|
/* Assumes dst will be NULL if not set. */
|
||||||
if (dst == NULL) {
|
if (dst == NULL) {
|
||||||
if ((dst = (char *) malloc(BUFSIZ)) == NULL) {
|
if ((dst = (char *) malloc(BUFSIZ)) == NULL) {
|
||||||
perror("malloc");
|
|
||||||
(void) fprintf(stderr, "%s: cannot allocate memory!\n", Argv[0]);
|
(void) fprintf(stderr, "%s: cannot allocate memory!\n", Argv[0]);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
@@ -886,7 +882,6 @@ static void append(src, dstp, dst_len, dst_size, separator)
|
|||||||
*dst_size += BUFSIZ;
|
*dst_size += BUFSIZ;
|
||||||
|
|
||||||
if (!(dst = (char *) realloc(dst, *dst_size))) {
|
if (!(dst = (char *) realloc(dst, *dst_size))) {
|
||||||
perror("malloc");
|
|
||||||
(void) fprintf(stderr, "%s: cannot allocate memory!\n", Argv[0]);
|
(void) fprintf(stderr, "%s: cannot allocate memory!\n", Argv[0]);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
@@ -932,14 +927,12 @@ static void expand_ga_list()
|
|||||||
if (ga_list == NULL) {
|
if (ga_list == NULL) {
|
||||||
if ((ga_list = (struct generic_alias *)
|
if ((ga_list = (struct generic_alias *)
|
||||||
malloc(sizeof(struct generic_alias) * ga_list_size)) == NULL) {
|
malloc(sizeof(struct generic_alias) * ga_list_size)) == NULL) {
|
||||||
perror("malloc");
|
|
||||||
(void) fprintf(stderr, "%s: cannot allocate memory!\n", Argv[0]);
|
(void) fprintf(stderr, "%s: cannot allocate memory!\n", Argv[0]);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if ((ga_list = (struct generic_alias *) realloc(ga_list,
|
if ((ga_list = (struct generic_alias *) realloc(ga_list,
|
||||||
sizeof(struct generic_alias) * ga_list_size)) == NULL) {
|
sizeof(struct generic_alias) * ga_list_size)) == NULL) {
|
||||||
perror("malloc");
|
|
||||||
(void) fprintf(stderr, "%s: cannot allocate memory!\n", Argv[0]);
|
(void) fprintf(stderr, "%s: cannot allocate memory!\n", Argv[0]);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
@@ -964,7 +957,6 @@ static void expand_match_list()
|
|||||||
if (cm_list == NULL) {
|
if (cm_list == NULL) {
|
||||||
if ((cm_list = (struct command_match *)
|
if ((cm_list = (struct command_match *)
|
||||||
malloc(sizeof(struct command_match) * cm_list_size)) == NULL) {
|
malloc(sizeof(struct command_match) * cm_list_size)) == NULL) {
|
||||||
perror("malloc");
|
|
||||||
(void) fprintf(stderr, "%s: cannot allocate memory!\n", Argv[0]);
|
(void) fprintf(stderr, "%s: cannot allocate memory!\n", Argv[0]);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
@@ -972,7 +964,6 @@ static void expand_match_list()
|
|||||||
} else {
|
} else {
|
||||||
if ((cm_list = (struct command_match *) realloc(cm_list,
|
if ((cm_list = (struct command_match *) realloc(cm_list,
|
||||||
sizeof(struct command_match) * cm_list_size)) == NULL) {
|
sizeof(struct command_match) * cm_list_size)) == NULL) {
|
||||||
perror("malloc");
|
|
||||||
(void) fprintf(stderr, "%s: cannot allocate memory!\n", Argv[0]);
|
(void) fprintf(stderr, "%s: cannot allocate memory!\n", Argv[0]);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
@@ -1008,7 +999,6 @@ void init_parser()
|
|||||||
stacksize = STACKINCREMENT;
|
stacksize = STACKINCREMENT;
|
||||||
match = (struct matchstack *) malloc(sizeof(struct matchstack) * stacksize);
|
match = (struct matchstack *) malloc(sizeof(struct matchstack) * stacksize);
|
||||||
if (match == NULL) {
|
if (match == NULL) {
|
||||||
perror("malloc");
|
|
||||||
(void) fprintf(stderr, "%s: cannot allocate memory!\n", Argv[0]);
|
(void) fprintf(stderr, "%s: cannot allocate memory!\n", Argv[0]);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user