summaryrefslogtreecommitdiffhomepage
path: root/mixlib
diff options
context:
space:
mode:
authorjaortega <jaortega>2000-12-01 23:35:35 +0000
committerjaortega <jaortega>2000-12-01 23:35:35 +0000
commit99cc30339d9cb98b240a6e0ef59c333fe3194018 (patch)
tree925888afb5390b55b38345846b5a06084c92de35 /mixlib
parent6861d82f0bca390a95609d548146f6629bde264f (diff)
downloadmdk-99cc30339d9cb98b240a6e0ef59c333fe3194018.tar.gz
mdk-99cc30339d9cb98b240a6e0ef59c333fe3194018.tar.bz2
removed checks for null pointer after g_new ()
Diffstat (limited to 'mixlib')
-rw-r--r--mixlib/mix_device.c2
-rw-r--r--mixlib/mix_file.c12
-rw-r--r--mixlib/mix_io.c1
-rw-r--r--mixlib/mix_parser.c10
-rw-r--r--mixlib/mix_scanner.l2
-rw-r--r--mixlib/mix_vm.c1
-rw-r--r--mixlib/mix_vm_dump.c2
7 files changed, 6 insertions, 24 deletions
diff --git a/mixlib/mix_device.c b/mixlib/mix_device.c
index 2e68f03..80e6ca8 100644
--- a/mixlib/mix_device.c
+++ b/mixlib/mix_device.c
@@ -71,7 +71,6 @@ mix_device_t *
mix_device_new (mix_device_type_t type)
{
mix_device_t *result = g_new (mix_device_t, 1);
- g_return_val_if_fail (result != NULL, result);
result->type = type;
if (type != mix_dev_CONSOLE) {
result->file = MIX_IOCHANNEL(mix_file_new_with_def_ext (DEF_NAMES_[type],
@@ -100,7 +99,6 @@ mix_device_new_with_name (mix_device_type_t type, const gchar *name)
mix_device_t *result = NULL;
g_return_val_if_fail (name != NULL, result);
result = g_new (mix_device_t, 1);
- g_return_val_if_fail (result != NULL, result);
result->type = type;
if (type != mix_dev_CONSOLE)
{
diff --git a/mixlib/mix_file.c b/mixlib/mix_file.c
index 45d45e0..9b79eef 100644
--- a/mixlib/mix_file.c
+++ b/mixlib/mix_file.c
@@ -48,14 +48,12 @@ open_file_(const gchar *name, mix_fmode_t mode)
mix_file_t *result;
FILE *file;
- file = fopen(name, fmode_to_type_(mode));
- if ( file == NULL ) return NULL;
result = g_new(mix_file_t, 1);
- if ( result == NULL )
- {
- fclose(file);
- return NULL;
- }
+ file = fopen(name, fmode_to_type_(mode));
+ if ( file == NULL ) {
+ g_free (result);
+ return NULL;
+ }
io_init_from_file_(MIX_IOCHANNEL(result), file);
return result;
}
diff --git a/mixlib/mix_io.c b/mixlib/mix_io.c
index 9014902..ef8ff34 100644
--- a/mixlib/mix_io.c
+++ b/mixlib/mix_io.c
@@ -28,7 +28,6 @@ mix_io_new (FILE *file)
mix_iochannel_t *result;
g_return_val_if_fail (file != NULL, NULL);
result = g_new (mix_iochannel_t, 1);
- g_return_val_if_fail (result != NULL, NULL);
result->file = file;
return result;
}
diff --git a/mixlib/mix_parser.c b/mixlib/mix_parser.c
index 80dff45..13df539 100644
--- a/mixlib/mix_parser.c
+++ b/mixlib/mix_parser.c
@@ -116,12 +116,6 @@ mix_parser_new (const gchar *in_file)
if ( f == NULL ) return NULL;
result = g_new (mix_parser_t, 1);
- if ( result == NULL )
- {
- g_warning (_("No system resources"));
- mix_file_delete (f);
- return NULL;
- }
result->symbol_table = mix_symbol_table_new ();
result->ls_table = mix_symbol_table_new ();
result->cur_ls = 0;
@@ -496,10 +490,6 @@ mix_parser_add_raw (mix_parser_t *parser, mix_word_t word, guint lineno)
if ( parser->status == MIX_PERR_NOCOMP || parser->status == MIX_PERR_OK )
{
ins_node_ *node = g_new (ins_node_, 1);
- if ( node == NULL ) {
- g_warning (_("Unable to allocate memory"));
- return;
- }
node->ins = word;
node->lineno = lineno;
g_tree_insert (parser->ins_table, (gpointer)((guint)parser->loc_count),
diff --git a/mixlib/mix_scanner.l b/mixlib/mix_scanner.l
index c5529da..084686f 100644
--- a/mixlib/mix_scanner.l
+++ b/mixlib/mix_scanner.l
@@ -1,4 +1,4 @@
-/* -*-c-*- ------------------ mix_scanner.l :
+/* -*-flex-*- ------------------ mix_scanner.l :
* Lexical scanner used by mix_parser_t
* ------------------------------------------------------------------
* Copyright (C) 2000 jose antonio ortega ruiz <jaortega@acm.org>
diff --git a/mixlib/mix_vm.c b/mixlib/mix_vm.c
index 3af272d..37a0c6d 100644
--- a/mixlib/mix_vm.c
+++ b/mixlib/mix_vm.c
@@ -58,7 +58,6 @@ mix_vm_new (void)
int i;
mix_vm_t *vm = g_new (struct mix_vm_t,1);
- g_return_val_if_fail (vm != NULL, NULL);
vm->line_table = NULL;
vm->symbol_table = NULL;
diff --git a/mixlib/mix_vm_dump.c b/mixlib/mix_vm_dump.c
index 33b5c38..c77e90b 100644
--- a/mixlib/mix_vm_dump.c
+++ b/mixlib/mix_vm_dump.c
@@ -40,8 +40,6 @@ mix_dump_context_new(gint fd, mix_address_t begin, mix_address_t end,
if ( end >= MEM_CELLS_NO_ ) end = MEM_CELLS_NO_;
result = g_new (mix_dump_context_t,1);
- g_return_val_if_fail (result != NULL, NULL);
-
result->options = options;
result->begin = begin;
result->end = end;