• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

taosdata / TDengine / #4986

15 Mar 2026 08:32AM UTC coverage: 37.305% (-31.3%) from 68.601%
#4986

push

travis-ci

tomchon
test: keep docs and unit test

125478 of 336361 relevant lines covered (37.3%)

1134847.06 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/contrib/TSZ/sz/src/DynamicIntArray.c
1
/**
2
 *  @file DynamicIntArray.c
3
 *  @author Sheng Di
4
 *  @date May, 2016
5
 *  @brief Dynamic Int Array
6
 *  (C) 2016 by Mathematics and Computer Science (MCS), Argonne National Laboratory.
7
 *      See COPYRIGHT in top-level directory.
8
 */
9

10
#include <stdlib.h> 
11
#include <stdio.h>
12
#include <string.h>
13
#include "DynamicIntArray.h"
14
#include "sz.h"
15

16
void new_DIA(DynamicIntArray **dia, size_t cap) {
×
17
                *dia = (DynamicIntArray *)malloc(sizeof(DynamicIntArray));
×
18
        (*dia)->size = 0;
×
19
        (*dia)->capacity = cap;
×
20
        (*dia)->array = (unsigned char*)malloc(sizeof(unsigned char)*cap);
×
21
    }
×
22

23
void convertDIAtoInts(DynamicIntArray *dia, unsigned char **data)
×
24
{
25
        size_t size = dia->size;
×
26
        if(size>0)
×
27
                *data = (unsigned char*)malloc(size * sizeof(char));
×
28
        else
29
                *data = NULL;
×
30
        memcpy(*data, dia->array, size*sizeof(unsigned char));        
×
31
}
×
32

33
void free_DIA(DynamicIntArray *dia)
×
34
{
35
        free(dia->array);
×
36
        free(dia);
×
37
}
×
38

39
int getDIA_Data(DynamicIntArray *dia, size_t pos)
×
40
{
41
        if(pos>=dia->size)
×
42
        {
43
                printf("Error: wrong position of DIA.\n");
×
44
                exit(0);
×
45
        }
46
        return dia->array[pos];
×
47
}
48

49
INLINE void addDIA_Data(DynamicIntArray *dia, int value)
×
50
{
51
        if(dia->size==dia->capacity)
×
52
        {
53
                dia->capacity = dia->capacity << 1;
×
54
                dia->array = (unsigned char *)realloc(dia->array, dia->capacity*sizeof(unsigned char));
×
55
        }
56
        dia->array[dia->size] = (unsigned char)value;
×
57
        dia->size ++;
×
58
}
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc