Fix RTEMS build in src/std/rec/test

Also back-ported Michael's change from commit b9b8cde5f6 to avoid
using callocMustSucceed() in eventNameToHandle()
This commit is contained in:
Andrew Johnson
2018-05-12 22:25:15 -05:00
parent 06ad4a0d70
commit 49371cfe00
3 changed files with 10 additions and 5 deletions

View File

@@ -6,7 +6,7 @@
* Copyright (c) 2013 Helmholtz-Zentrum Berlin
* für Materialien und Energie GmbH.
* EPICS BASE is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
* in file LICENSE that is included with this distribution.
\*************************************************************************/
/* dbScan.c */
/* tasks and subroutines to scan the database */
@@ -502,9 +502,10 @@ event_list *eventNameToHandle(const char *eventname)
break;
}
if (pel == NULL) {
pel = dbCalloc(1, sizeof(event_list) + namelength);
if (eventnumber > 0)
{
pel = calloc(1, sizeof(event_list) + namelength);
if (!pel)
goto done;
if (eventnumber > 0) {
/* backward compatibility: make all numeric events look like integers */
sprintf(pel->eventname, "%i", (int)eventnumber);
pevent_list[(int)eventnumber] = pel;
@@ -521,6 +522,7 @@ event_list *eventNameToHandle(const char *eventname)
pel->next=pevent_list[0];
pevent_list[0]=pel;
}
done:
epicsMutexUnlock(event_lock);
return pel;
}

View File

@@ -4,7 +4,7 @@
# Copyright (c) 2002 The Regents of the University of California, as
# Operator of Los Alamos National Laboratory.
# EPICS BASE is distributed subject to a Software License Agreement found
# in the file LICENSE that is included with this distribution.
# in the file LICENSE that is included with this distribution.
#*************************************************************************
TOP=../../../..
@@ -43,6 +43,8 @@ scanEventTest_DBD += base.dbd
TESTPROD_HOST += scanEventTest
scanEventTest_SRCS += scanEventTest.c
scanEventTest_SRCS += scanEventTest_registerRecordDeviceDriver.cpp
testHarness_SRCS += scanEventTest.c
testHarness_SRCS += scanEventTest_registerRecordDeviceDriver.cpp
TESTFILES += $(COMMON_DIR)/scanEventTest.dbd ../scanEventTest.db
TESTS += scanEventTest

View File

@@ -23,6 +23,7 @@ void epicsRunRecordTests(void)
runTest(analogMonitorTest);
runTest(arrayOpTest);
runTest(scanEventTest);
epicsExit(0); /* Trigger test harness */