merge bug fix of set module

This commit is contained in:
Dhanya Maliakal
2017-10-27 16:16:29 +02:00
7 changed files with 21 additions and 19 deletions

View File

@ -1725,7 +1725,7 @@ int set_module(int file_des) {
int *myChan = NULL;
myDac=(int*)malloc(getNumberOfDACsPerModule()*sizeof(int));
if (myDac == NULL) {
if (getNumberOfDACsPerModule() > 0 && myDac == NULL) {
ret = FAIL;
sprintf(mess,"could not allocate dacs\n");
cprintf(RED, "Warning: %s", mess);
@ -1733,7 +1733,7 @@ int set_module(int file_des) {
else {
myModule.dacs=myDac;
myAdc=(int*)malloc(getNumberOfADCsPerModule()*sizeof(int));
if (myAdc == NULL) {
if (getNumberOfADCsPerModule() > 0 && myAdc == NULL) {
ret = FAIL;
sprintf(mess,"could not allocate adcs\n");
cprintf(RED, "Warning: %s", mess);
@ -1746,7 +1746,7 @@ int set_module(int file_des) {
myModule.chanregs=NULL;
#else
myChip=(int*)malloc(getNumberOfChipsPerModule()*sizeof(int));
if (myChip == NULL) {
if (getNumberOfChipsPerModule() > 0 && myChip == NULL) {
ret = FAIL;
sprintf(mess,"could not allocate chips\n");
cprintf(RED, "Warning: %s", mess);
@ -1754,7 +1754,7 @@ int set_module(int file_des) {
else {
myModule.chipregs=myChip;
myChan=(int*)malloc(getNumberOfChannelsPerModule()*sizeof(int));
if (myChan == NULL) {
if (getNumberOfChannelsPerModule() > 0 && myChan == NULL) {
ret = FAIL;
sprintf(mess,"could not allocate chans\n");
cprintf(RED, "Warning: %s", mess);
@ -1947,7 +1947,7 @@ int get_module(int file_des) {
}
else {
myDac=(int*)malloc(getNumberOfDACsPerModule()*sizeof(int));
if (myDac == NULL) {
if (getNumberOfDACsPerModule() > 0 && myDac == NULL) {
ret = FAIL;
sprintf(mess,"could not allocate dacs\n");
cprintf(RED, "Warning: %s", mess);
@ -1955,7 +1955,7 @@ int get_module(int file_des) {
else {
myModule.dacs=myDac;
myAdc=(int*)malloc(getNumberOfADCsPerModule()*sizeof(int));
if (myAdc == NULL) {
if (getNumberOfADCsPerModule() > 0 && myAdc == NULL) {
ret = FAIL;
sprintf(mess,"could not allocate adcs\n");
cprintf(RED, "Warning: %s", mess);
@ -1968,7 +1968,7 @@ int get_module(int file_des) {
myModule.chanregs=NULL;
#else
myChip=(int*)malloc(getNumberOfChipsPerModule()*sizeof(int));
if (myChip == NULL) {
if (getNumberOfChipsPerModule() > 0 && myChip == NULL) {
ret = FAIL;
sprintf(mess,"could not allocate chips\n");
cprintf(RED, "Warning: %s", mess);
@ -1976,7 +1976,7 @@ int get_module(int file_des) {
else {
myModule.chipregs=myChip;
myChan=(int*)malloc(getNumberOfChannelsPerModule()*sizeof(int));
if (myChan == NULL) {
if (getNumberOfChannelsPerModule() > 0 && myChan == NULL) {
ret = FAIL;
sprintf(mess,"could not allocate chans\n");
cprintf(RED, "Warning: %s", mess);