[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 2/8] hw/audio/fmopl.c: Fixing some style errors
From: |
Mahmoud Mandour |
Subject: |
[PATCH 2/8] hw/audio/fmopl.c: Fixing some style errors |
Date: |
Sun, 14 Mar 2021 05:23:18 +0200 |
Fixed style errors on the relevant lines in which
I will introduce changes.
Signed-off-by: Mahmoud Mandour <ma.mandourr@gmail.com>
---
hw/audio/fmopl.c | 58 ++++++++++++++++++++++++++----------------------
1 file changed, 32 insertions(+), 26 deletions(-)
diff --git a/hw/audio/fmopl.c b/hw/audio/fmopl.c
index 8a71a569fa..51b773695a 100644
--- a/hw/audio/fmopl.c
+++ b/hw/audio/fmopl.c
@@ -607,26 +607,32 @@ static int OPLOpenTable( void )
double pom;
/* allocate dynamic tables */
- if( (TL_TABLE = malloc(TL_MAX*2*sizeof(int32_t))) == NULL)
- return 0;
- if( (SIN_TABLE = malloc(SIN_ENT*4 *sizeof(int32_t *))) == NULL)
- {
- free(TL_TABLE);
- return 0;
- }
- if( (AMS_TABLE = malloc(AMS_ENT*2 *sizeof(int32_t))) == NULL)
- {
- free(TL_TABLE);
- free(SIN_TABLE);
- return 0;
- }
- if( (VIB_TABLE = malloc(VIB_ENT*2 *sizeof(int32_t))) == NULL)
- {
- free(TL_TABLE);
- free(SIN_TABLE);
- free(AMS_TABLE);
- return 0;
- }
+ TL_TABLE = malloc(TL_MAX * 2 * sizeof(int32_t));
+ if (TL_TABLE == NULL) {
+ return 0;
+ }
+
+ SIN_TABLE = malloc(SIN_ENT * 4 * sizeof(int32_t *));
+ if (SIN_TABLE == NULL) {
+ free(TL_TABLE);
+ return 0;
+ }
+
+ AMS_TABLE = malloc(AMS_ENT * 2 * sizeof(int32_t));
+ if (AMS_TABLE == NULL) {
+ free(TL_TABLE);
+ free(SIN_TABLE);
+ return 0;
+ }
+
+ VIB_TABLE = malloc(VIB_ENT * 2 * sizeof(int32_t));
+ if (VIB_TABLE == NULL) {
+ free(TL_TABLE);
+ free(SIN_TABLE);
+ free(AMS_TABLE);
+ return 0;
+ }
+
ENV_CURVE = g_new(int32_t, 2 * EG_ENT + 1);
/* make total level table */
for (t = 0;t < EG_ENT-1 ;t++){
@@ -696,10 +702,10 @@ static int OPLOpenTable( void )
static void OPLCloseTable( void )
{
g_free(ENV_CURVE);
- free(TL_TABLE);
- free(SIN_TABLE);
- free(AMS_TABLE);
- free(VIB_TABLE);
+ free(TL_TABLE);
+ free(SIN_TABLE);
+ free(AMS_TABLE);
+ free(VIB_TABLE);
}
/* CSM Key Control */
@@ -1082,7 +1088,7 @@ FM_OPL *OPLCreate(int clock, int rate)
state_size = sizeof(FM_OPL);
state_size += sizeof(OPL_CH)*max_ch;
/* allocate memory block */
- ptr = malloc(state_size);
+ ptr = malloc(state_size);
if(ptr==NULL) return NULL;
/* clear */
memset(ptr,0,state_size);
@@ -1128,7 +1134,7 @@ void OPLDestroy(FM_OPL *OPL)
}
#endif
OPL_UnLockTable();
- free(OPL);
+ free(OPL);
}
/* ---------- Option handlers ---------- */
--
2.25.1
[PATCH 4/8] target/xtensa: Replaced malloc/free with GLib's variants, Mahmoud Mandour, 2021/03/13
[PATCH 7/8] tools/virtiofsd/fuse_opt.c: Replaced a malloc with GLib's g_try_malloc, Mahmoud Mandour, 2021/03/13
[PATCH 3/8] hw/audio/fmopl.c: Replaced calls to malloc with GLib's variants, Mahmoud Mandour, 2021/03/13