SolidSyslog coverage report
Current view: top level - Platform/VxWorks64/Source - SolidSyslogVxWorks64AtomicCounter.c (source / functions) Coverage Total Hit
Test: SolidSyslog Lines: 100.0 % 20 20
Test Date: 2026-11-12 23:14:35 Functions: 100.0 % 5 5
Branches: 100.0 % 2 2

             Branch data     Line data    Source code
       1                 :             : /* SPDX-FileCopyrightText: Copyright 2026 Cozens Software Solutions Limited
       2                 :             :  * SPDX-License-Identifier: PolyForm-Noncommercial-1.0.0 OR LicenseRef-PolyForm-Internal-Use-1.0.0 OR LicenseRef-COSOSO-Commercial
       3                 :             :  */
       4                 :             : 
       5                 :             : #include "SolidSyslogVxWorks64AtomicCounter.h"
       6                 :             : 
       7                 :             : #include <stdint.h>
       8                 :             : 
       9                 :             : #include "vxWorks.h"
      10                 :             : 
      11                 :             : #include "intLib.h"
      12                 :             : 
      13                 :             : #include "SolidSyslogAtomicCounter.h"
      14                 :             : #include "SolidSyslogAtomicCounterDefinition.h"
      15                 :             : #include "SolidSyslogError.h"
      16                 :             : #include "SolidSyslogNullAtomicCounter.h"
      17                 :             : #include "SolidSyslogVxWorks64AtomicCounterPrivate.h"
      18                 :             : 
      19                 :             : const struct SolidSyslogErrorSource SolidSyslogVxWorks64AtomicCounterErrorSource = {
      20                 :             :     "VxWorks64AtomicCounter",
      21                 :             :     SolidSyslogAtomicCounterErrors_Name
      22                 :             : };
      23                 :             : 
      24                 :             : static uint32_t VxWorks64AtomicCounter_Increment(struct SolidSyslogAtomicCounter* base);
      25                 :             : static void VxWorks64AtomicCounter_Init(struct SolidSyslogVxWorks64AtomicCounter* self, uint32_t value);
      26                 :             : 
      27                 :             : static inline struct SolidSyslogVxWorks64AtomicCounter* VxWorks64AtomicCounter_SelfFromBase(
      28                 :             :     struct SolidSyslogAtomicCounter* base
      29                 :             : );
      30                 :             : 
      31                 :          71 : void SolidSyslogVxWorks64AtomicCounter_Initialise(struct SolidSyslogAtomicCounter* base)
      32                 :             : {
      33                 :          71 :     struct SolidSyslogVxWorks64AtomicCounter* self = VxWorks64AtomicCounter_SelfFromBase(base);
      34                 :          71 :     self->Base.Increment = VxWorks64AtomicCounter_Increment;
      35                 :          71 :     VxWorks64AtomicCounter_Init(self, 0U);
      36                 :          71 : }
      37                 :             : 
      38                 :         134 : static inline struct SolidSyslogVxWorks64AtomicCounter* VxWorks64AtomicCounter_SelfFromBase(
      39                 :             :     struct SolidSyslogAtomicCounter* base
      40                 :             : )
      41                 :             : {
      42                 :         134 :     return (struct SolidSyslogVxWorks64AtomicCounter*) base;
      43                 :             : }
      44                 :             : 
      45                 :          76 : static void VxWorks64AtomicCounter_Init(struct SolidSyslogVxWorks64AtomicCounter* self, uint32_t value)
      46                 :             : {
      47                 :          76 :     self->Value = value;
      48                 :          76 : }
      49                 :             : 
      50                 :          71 : void SolidSyslogVxWorks64AtomicCounter_Cleanup(struct SolidSyslogAtomicCounter* base)
      51                 :             : {
      52                 :             :     /* Use-after-destroy lands on the NullAtomicCounter vtable. */
      53                 :          71 :     *base = *SolidSyslogNullAtomicCounter_Get();
      54                 :          71 : }
      55                 :             : 
      56                 :          58 : static uint32_t VxWorks64AtomicCounter_Increment(struct SolidSyslogAtomicCounter* base)
      57                 :             : {
      58                 :          58 :     struct SolidSyslogVxWorks64AtomicCounter* self = VxWorks64AtomicCounter_SelfFromBase(base);
      59                 :          58 :     int lockKey = intLock();
      60         [ +  + ]:          58 :     self->Value = (self->Value >= SOLIDSYSLOG_SEQUENCE_ID_MAX) ? 1U : (self->Value + 1U);
      61                 :          58 :     uint32_t next = self->Value;
      62                 :          58 :     (void) intUnlock(lockKey);
      63                 :          58 :     return next;
      64                 :             : }
        

Generated by: LCOV version 2.0-1