Coverage Report

Created: 2026-11-12 07:35

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/imagemagick/MagickCore/random-private.h
Line
Count
Source
1
/*
2
  Copyright @ 1999 ImageMagick Studio LLC, a non-profit organization
3
  dedicated to making software imaging solutions freely available.
4
5
  You may not use this file except in compliance with the License.  You may
6
  obtain a copy of the License at
7
8
    https://imagemagick.org/license/
9
10
  Unless required by applicable law or agreed to in writing, software
11
  distributed under the License is distributed on an "AS IS" BASIS,
12
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
  See the License for the specific language governing permissions and
14
  limitations under the License.
15
16
  MagickCore random generation private methods.
17
*/
18
#ifndef MAGICKCORE_RANDOM_PRIVATE_H
19
#define MAGICKCORE_RANDOM_PRIVATE_H
20
21
#include "MagickCore/thread-private.h"
22
23
#if defined(__cplusplus) || defined(c_plusplus)
24
extern "C" {
25
#endif
26
27
extern MagickPrivate double
28
  GetRandomInfoNormalize(const RandomInfo *);
29
30
extern MagickPrivate MagickBooleanType
31
  RandomComponentGenesis(void);
32
33
extern MagickPrivate unsigned long
34
  *GetRandomInfoSeed(RandomInfo *);
35
36
extern MagickPrivate void
37
  RandomComponentTerminus(void);
38
39
static inline RandomInfo **DestroyRandomInfoTLS(RandomInfo **random_info)
40
5.88k
{
41
5.88k
  ssize_t
42
5.88k
    i;
43
44
11.7k
  for (i=0; i < (ssize_t) GetMagickResourceLimit(ThreadResource); i++)
45
5.88k
    if (random_info[i] != (RandomInfo *) NULL)
46
5.88k
      random_info[i]=DestroyRandomInfo(random_info[i]);
47
5.88k
  return((RandomInfo **) RelinquishMagickMemory(random_info));
48
5.88k
}
Unexecuted instantiation: effect.c:DestroyRandomInfoTLS
fx.c:DestroyRandomInfoTLS
Line
Count
Source
40
5.88k
{
41
5.88k
  ssize_t
42
5.88k
    i;
43
44
11.7k
  for (i=0; i < (ssize_t) GetMagickResourceLimit(ThreadResource); i++)
45
5.88k
    if (random_info[i] != (RandomInfo *) NULL)
46
5.88k
      random_info[i]=DestroyRandomInfo(random_info[i]);
47
5.88k
  return((RandomInfo **) RelinquishMagickMemory(random_info));
48
5.88k
}
Unexecuted instantiation: magick.c:DestroyRandomInfoTLS
Unexecuted instantiation: opencl.c:DestroyRandomInfoTLS
Unexecuted instantiation: random.c:DestroyRandomInfoTLS
Unexecuted instantiation: statistic.c:DestroyRandomInfoTLS
Unexecuted instantiation: threshold.c:DestroyRandomInfoTLS
Unexecuted instantiation: visual-effects.c:DestroyRandomInfoTLS
Unexecuted instantiation: plasma.c:DestroyRandomInfoTLS
49
50
static inline RandomInfo **AcquireRandomInfoTLS(void)
51
5.88k
{
52
5.88k
  ssize_t
53
5.88k
    i;
54
55
5.88k
  RandomInfo
56
5.88k
    **random_info;
57
58
5.88k
  size_t
59
5.88k
    number_threads;
60
61
5.88k
  number_threads=(size_t) GetMagickResourceLimit(ThreadResource);
62
5.88k
  random_info=(RandomInfo **) AcquireQuantumMemory(number_threads,
63
5.88k
    sizeof(*random_info));
64
5.88k
  if (random_info == (RandomInfo **) NULL)
65
5.88k
    ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed");
66
5.88k
  (void) memset(random_info,0,number_threads*sizeof(*random_info));
67
11.7k
  for (i=0; i < (ssize_t) number_threads; i++)
68
5.88k
    random_info[i]=AcquireRandomInfo();
69
5.88k
  return(random_info);
70
5.88k
}
Unexecuted instantiation: effect.c:AcquireRandomInfoTLS
fx.c:AcquireRandomInfoTLS
Line
Count
Source
51
5.88k
{
52
5.88k
  ssize_t
53
5.88k
    i;
54
55
5.88k
  RandomInfo
56
5.88k
    **random_info;
57
58
5.88k
  size_t
59
5.88k
    number_threads;
60
61
5.88k
  number_threads=(size_t) GetMagickResourceLimit(ThreadResource);
62
5.88k
  random_info=(RandomInfo **) AcquireQuantumMemory(number_threads,
63
5.88k
    sizeof(*random_info));
64
5.88k
  if (random_info == (RandomInfo **) NULL)
65
5.88k
    ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed");
66
5.88k
  (void) memset(random_info,0,number_threads*sizeof(*random_info));
67
11.7k
  for (i=0; i < (ssize_t) number_threads; i++)
68
5.88k
    random_info[i]=AcquireRandomInfo();
69
5.88k
  return(random_info);
70
5.88k
}
Unexecuted instantiation: magick.c:AcquireRandomInfoTLS
Unexecuted instantiation: opencl.c:AcquireRandomInfoTLS
Unexecuted instantiation: random.c:AcquireRandomInfoTLS
Unexecuted instantiation: statistic.c:AcquireRandomInfoTLS
Unexecuted instantiation: threshold.c:AcquireRandomInfoTLS
Unexecuted instantiation: visual-effects.c:AcquireRandomInfoTLS
Unexecuted instantiation: plasma.c:AcquireRandomInfoTLS
71
72
#if defined(__cplusplus) || defined(c_plusplus)
73
}
74
#endif
75
76
#endif