Skip to content

Commit bc09c69

Browse files
committed
Fix #84, Remove superfluous assignments at the top of functions
1 parent 9d3daa7 commit bc09c69

5 files changed

Lines changed: 103 additions & 103 deletions

File tree

fsw/src/fm_app.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ void FM_AppMain(void)
6565
{
6666
uint32 RunStatus = CFE_ES_RunStatus_APP_RUN;
6767
CFE_SB_Buffer_t *BufPtr = NULL;
68-
int32 Result = CFE_SUCCESS;
68+
int32 Result;
6969

7070
/* Performance Log (start time counter) */
7171
CFE_ES_PerfLogEntry(FM_APPMAIN_PERF_ID);
@@ -167,7 +167,7 @@ void FM_AppMain(void)
167167
int32 FM_AppInit(void)
168168
{
169169
const char *ErrText = "Initialization error:";
170-
int32 Result = CFE_SUCCESS;
170+
int32 Result;
171171

172172
/* Initialize global data */
173173
memset(&FM_GlobalData, 0, sizeof(FM_GlobalData));
@@ -390,7 +390,7 @@ void FM_ProcessCmd(const CFE_SB_Buffer_t *BufPtr)
390390
void FM_SendHkCmd(const CFE_SB_Buffer_t *BufPtr)
391391
{
392392
const char * CmdText = "HK Request";
393-
bool Result = true;
393+
bool Result;
394394
FM_HousekeepingPkt_Payload_t *PayloadPtr;
395395

396396
/* Verify command packet length */

fsw/src/fm_child.c

Lines changed: 44 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ int32 FM_ChildInit(void)
5858
{
5959
int32 TaskTextLen = OS_MAX_PATH_LEN;
6060
char TaskText[OS_MAX_PATH_LEN] = "\0";
61-
int32 Result = CFE_SUCCESS;
62-
uint32 TaskEID = 0;
61+
int32 Result;
62+
uint32 TaskEID = 0;
6363

6464
/* Create counting semaphore (given by parent to wake-up child) */
6565
Result = OS_CountSemCreate(&FM_GlobalData.ChildSemaphore, FM_CHILD_SEM_NAME, 0, 0);
@@ -279,8 +279,8 @@ void FM_ChildProcess(void)
279279

280280
void FM_ChildCopyCmd(const FM_ChildQueueEntry_t *CmdArgs)
281281
{
282-
const char *CmdText = "Copy File";
283-
int32 OS_Status = OS_SUCCESS;
282+
const char *CmdText = "Copy File";
283+
int32 OS_Status;
284284

285285
/* Report current child task activity */
286286
FM_GlobalData.ChildCurrentCC = CmdArgs->CommandCode;
@@ -319,8 +319,8 @@ void FM_ChildCopyCmd(const FM_ChildQueueEntry_t *CmdArgs)
319319

320320
void FM_ChildMoveCmd(const FM_ChildQueueEntry_t *CmdArgs)
321321
{
322-
const char *CmdText = "Move File";
323-
int32 OS_Status = OS_SUCCESS;
322+
const char *CmdText = "Move File";
323+
int32 OS_Status;
324324

325325
/* Report current child task activity */
326326
FM_GlobalData.ChildCurrentCC = CmdArgs->CommandCode;
@@ -358,8 +358,8 @@ void FM_ChildMoveCmd(const FM_ChildQueueEntry_t *CmdArgs)
358358

359359
void FM_ChildRenameCmd(const FM_ChildQueueEntry_t *CmdArgs)
360360
{
361-
const char *CmdText = "Rename File";
362-
int32 OS_Status = OS_SUCCESS;
361+
const char *CmdText = "Rename File";
362+
int32 OS_Status;
363363

364364
/* Report current child task activity */
365365
FM_GlobalData.ChildCurrentCC = CmdArgs->CommandCode;
@@ -397,8 +397,8 @@ void FM_ChildRenameCmd(const FM_ChildQueueEntry_t *CmdArgs)
397397

398398
void FM_ChildDeleteCmd(const FM_ChildQueueEntry_t *CmdArgs)
399399
{
400-
const char *CmdText = "Delete File";
401-
int32 OS_Status = OS_SUCCESS;
400+
const char *CmdText = "Delete File";
401+
int32 OS_Status;
402402

403403
/* Report current child task activity */
404404
FM_GlobalData.ChildCurrentCC = CmdArgs->CommandCode;
@@ -439,7 +439,7 @@ void FM_ChildDeleteAllFilesCmd(FM_ChildQueueEntry_t *CmdArgs)
439439
const char *CmdText = "Delete All Files";
440440
osal_id_t DirId = OS_OBJECT_ID_UNDEFINED;
441441
os_dirent_t DirEntry;
442-
int32 OS_Status = OS_SUCCESS;
442+
int32 OS_Status;
443443
uint32 FilenameState = FM_NAME_IS_INVALID;
444444
uint32 NameLength = 0;
445445
uint32 DeleteCount = 0;
@@ -587,8 +587,8 @@ void FM_ChildDeleteAllFilesCmd(FM_ChildQueueEntry_t *CmdArgs)
587587

588588
void FM_ChildDecompressFileCmd(const FM_ChildQueueEntry_t *CmdArgs)
589589
{
590-
const char *CmdText = "Decompress File";
591-
int32 CFE_Status = CFE_SUCCESS;
590+
const char *CmdText = "Decompress File";
591+
int32 CFE_Status;
592592

593593
/* Report current child task activity */
594594
FM_GlobalData.ChildCurrentCC = CmdArgs->CommandCode;
@@ -634,11 +634,11 @@ void FM_ChildConcatFilesCmd(const FM_ChildQueueEntry_t *CmdArgs)
634634
bool OpenedSource2 = false;
635635
bool OpenedTgtFile = false;
636636
int32 LoopCount = 0;
637-
int32 OS_Status = OS_SUCCESS;
638-
osal_id_t FileHandleSrc = OS_OBJECT_ID_UNDEFINED;
639-
osal_id_t FileHandleTgt = OS_OBJECT_ID_UNDEFINED;
640-
int32 BytesRead = 0;
641-
int32 BytesWritten = 0;
637+
int32 OS_Status;
638+
osal_id_t FileHandleSrc = OS_OBJECT_ID_UNDEFINED;
639+
osal_id_t FileHandleTgt = OS_OBJECT_ID_UNDEFINED;
640+
int32 BytesRead = 0;
641+
int32 BytesWritten = 0;
642642

643643
/* Report current child task activity */
644644
FM_GlobalData.ChildCurrentCC = CmdArgs->CommandCode;
@@ -963,8 +963,8 @@ void FM_ChildFileInfoCmd(FM_ChildQueueEntry_t *CmdArgs)
963963

964964
void FM_ChildCreateDirectoryCmd(const FM_ChildQueueEntry_t *CmdArgs)
965965
{
966-
const char *CmdText = "Create Directory";
967-
int32 OS_Status = OS_SUCCESS;
966+
const char *CmdText = "Create Directory";
967+
int32 OS_Status;
968968

969969
/* Report current child task activity */
970970
FM_GlobalData.ChildCurrentCC = CmdArgs->CommandCode;
@@ -1006,7 +1006,7 @@ void FM_ChildDeleteDirectoryCmd(const FM_ChildQueueEntry_t *CmdArgs)
10061006
bool RemoveTheDir = true;
10071007
osal_id_t DirId = OS_OBJECT_ID_UNDEFINED;
10081008
os_dirent_t DirEntry;
1009-
int32 OS_Status = OS_SUCCESS;
1009+
int32 OS_Status;
10101010

10111011
memset(&DirEntry, 0, sizeof(DirEntry));
10121012

@@ -1080,11 +1080,11 @@ void FM_ChildDeleteDirectoryCmd(const FM_ChildQueueEntry_t *CmdArgs)
10801080

10811081
void FM_ChildDirListFileCmd(const FM_ChildQueueEntry_t *CmdArgs)
10821082
{
1083-
const char *CmdText = "Directory List to File";
1084-
bool Result = false;
1083+
const char *CmdText = "Directory List to File";
1084+
bool Result;
10851085
osal_id_t FileHandle = OS_OBJECT_ID_UNDEFINED;
10861086
osal_id_t DirId = OS_OBJECT_ID_UNDEFINED;
1087-
int32 Status = 0;
1087+
int32 Status;
10881088

10891089
/* Report current child task activity */
10901090
FM_GlobalData.ChildCurrentCC = CmdArgs->CommandCode;
@@ -1142,12 +1142,12 @@ void FM_ChildDirListPktCmd(const FM_ChildQueueEntry_t *CmdArgs)
11421142
{
11431143
const char * CmdText = "Directory List to Packet";
11441144
char LogicalName[OS_MAX_PATH_LEN] = "\0";
1145-
bool StillProcessing = true;
1146-
osal_id_t DirId = OS_OBJECT_ID_UNDEFINED;
1145+
bool StillProcessing;
1146+
osal_id_t DirId = OS_OBJECT_ID_UNDEFINED;
11471147
os_dirent_t DirEntry;
1148-
int32 ListIndex = 0;
1149-
FM_DirListEntry_t *ListEntry = NULL;
1150-
int32 PathLength = 0;
1148+
int32 ListIndex = 0;
1149+
FM_DirListEntry_t *ListEntry = NULL;
1150+
int32 PathLength;
11511151
int32 EntryLength = 0;
11521152
int32 FilesTillSleep = FM_CHILD_STAT_SLEEP_FILECOUNT;
11531153
int32 Status;
@@ -1275,8 +1275,8 @@ void FM_ChildDirListPktCmd(const FM_ChildQueueEntry_t *CmdArgs)
12751275
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
12761276
void FM_ChildSetPermissionsCmd(const FM_ChildQueueEntry_t *CmdArgs)
12771277
{
1278-
int32 OS_Status = OS_SUCCESS;
1279-
const char *CmdText = "Set Permissions";
1278+
int32 OS_Status;
1279+
const char *CmdText = "Set Permissions";
12801280

12811281
OS_Status = OS_chmod(CmdArgs->Source1, CmdArgs->Mode);
12821282

@@ -1316,7 +1316,7 @@ bool FM_ChildDirListFileInit(osal_id_t *FileHandlePtr, const char *Directory, co
13161316
CFE_FS_Header_t FileHeader;
13171317
osal_id_t FileHandle = OS_OBJECT_ID_UNDEFINED;
13181318
int32 BytesWritten = 0;
1319-
int32 Status = 0;
1319+
int32 Status;
13201320

13211321
/* Initialize the standard cFE File Header for the Directory Listing File */
13221322
CFE_FS_InitHeader(&FileHeader, CmdText, FM_DIR_LIST_FILE_SUBTYPE);
@@ -1392,17 +1392,17 @@ bool FM_ChildDirListFileInit(osal_id_t *FileHandlePtr, const char *Directory, co
13921392
void FM_ChildDirListFileLoop(osal_id_t DirId, osal_id_t FileHandle, const char *Directory, const char *DirWithSep,
13931393
const char *Filename, uint8 getSizeTimeMode)
13941394
{
1395-
const char * CmdText = "Directory List to File";
1396-
int32 WriteLength = sizeof(FM_DirListEntry_t);
1397-
bool ReadingDirectory = true;
1398-
bool CommandResult = true;
1399-
uint32 DirEntries = 0;
1400-
uint32 FileEntries = 0;
1401-
int32 EntryLength = 0;
1402-
int32 PathLength = 0;
1403-
int32 BytesWritten = 0;
1404-
int32 FilesTillSleep = FM_CHILD_STAT_SLEEP_FILECOUNT;
1405-
int32 Status = 0;
1395+
const char * CmdText = "Directory List to File";
1396+
int32 WriteLength = sizeof(FM_DirListEntry_t);
1397+
bool ReadingDirectory = true;
1398+
bool CommandResult = true;
1399+
uint32 DirEntries = 0;
1400+
uint32 FileEntries = 0;
1401+
int32 EntryLength = 0;
1402+
int32 PathLength;
1403+
int32 BytesWritten = 0;
1404+
int32 FilesTillSleep = FM_CHILD_STAT_SLEEP_FILECOUNT;
1405+
int32 Status;
14061406
char TempName[OS_MAX_PATH_LEN] = "\0";
14071407
os_dirent_t DirEntry;
14081408
FM_DirListEntry_t DirListData;
@@ -1529,7 +1529,7 @@ void FM_ChildDirListFileLoop(osal_id_t DirId, osal_id_t FileHandle, const char *
15291529

15301530
int32 FM_ChildSizeTimeMode(const char *Filename, uint32 *FileSize, uint32 *FileTime, uint32 *FileMode)
15311531
{
1532-
int32 Result = OS_SUCCESS;
1532+
int32 Result;
15331533
os_fstat_t FileStatus;
15341534

15351535
memset(&FileStatus, 0, sizeof(FileStatus));

fsw/src/fm_cmd_utils.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -273,10 +273,10 @@ uint32 FM_VerifyNameValid(const char *Name, uint32 BufferSize, uint32 EventID, c
273273
bool FM_VerifyFileState(FM_File_States State, const char *Filename, uint32 BufferSize, uint32 EventID,
274274
const char *CmdText)
275275
{
276-
bool Result = false;
277-
uint32 FilenameState = FM_NAME_IS_INVALID;
278-
uint32 ErrorCode = FM_FNAME_INVALID_EID_OFFSET;
279-
const char *ErrorDesc = "";
276+
bool Result = false;
277+
uint32 FilenameState;
278+
uint32 ErrorCode = FM_FNAME_INVALID_EID_OFFSET;
279+
const char *ErrorDesc = "";
280280
char LocalFile[1 + OS_MAX_PATH_LEN];
281281

282282
/* Get state of the filename */
@@ -532,9 +532,7 @@ void FM_AppendPathSep(char *Directory, uint32 BufferSize)
532532
** the string is both non-zero and less than the size
533533
** of the string buffer.
534534
*/
535-
uint32 StringLength = 0;
536-
537-
StringLength = strlen(Directory);
535+
uint32 StringLength = strlen(Directory);
538536

539537
/* Do nothing if string already ends with a path separator */
540538
if ((StringLength != 0) && (Directory[StringLength - 1] != '/'))

0 commit comments

Comments
 (0)