LCOV - code coverage report
Current view: top level - glib/deprecated - gallocator.c (source / functions) Coverage Total Hit
Test: unnamed Lines: 45.2 % 31 14
Test Date: 2025-11-04 05:15:38 Functions: 22.2 % 18 4
Branches: - 0 0

             Branch data     Line data    Source code
       1                 :             : /*
       2                 :             :  * This library is free software; you can redistribute it and/or
       3                 :             :  * modify it under the terms of the GNU Lesser General Public
       4                 :             :  * License as published by the Free Software Foundation; either
       5                 :             :  * version 2.1 of the License, or (at your option) any later version.
       6                 :             :  *
       7                 :             :  * This library is distributed in the hope that it will be useful,
       8                 :             :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
       9                 :             :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
      10                 :             :  * Lesser General Public License for more details.
      11                 :             :  *
      12                 :             :  * You should have received a copy of the GNU Lesser General Public
      13                 :             :  * License along with this library; if not, see <http://www.gnu.org/licenses/>.
      14                 :             :  */
      15                 :             : 
      16                 :             : #include "config.h"
      17                 :             : 
      18                 :             : /* we know we are deprecated here, no need for warnings */
      19                 :             : #ifndef GLIB_DISABLE_DEPRECATION_WARNINGS
      20                 :             : #define GLIB_DISABLE_DEPRECATION_WARNINGS
      21                 :             : #endif
      22                 :             : 
      23                 :             : #include "gallocator.h"
      24                 :             : 
      25                 :             : #include <glib/gmessages.h>
      26                 :             : #include <glib/gslice.h>
      27                 :             : 
      28                 :             : /**
      29                 :             :  * GAllocator:
      30                 :             :  *
      31                 :             :  * Deprecated: 2.10
      32                 :             :  */
      33                 :             : 
      34                 :             : /**
      35                 :             :  * G_ALLOC_ONLY:
      36                 :             :  *
      37                 :             :  * Deprecated: 2.10
      38                 :             :  */
      39                 :             : 
      40                 :             : /**
      41                 :             :  * G_ALLOC_AND_FREE:
      42                 :             :  *
      43                 :             :  * Deprecated: 2.10
      44                 :             :  */
      45                 :             : 
      46                 :             : /**
      47                 :             :  * G_ALLOCATOR_LIST:
      48                 :             :  *
      49                 :             :  * Deprecated: 2.10
      50                 :             :  */
      51                 :             : 
      52                 :             : /**
      53                 :             :  * G_ALLOCATOR_SLIST:
      54                 :             :  *
      55                 :             :  * Deprecated: 2.10
      56                 :             :  */
      57                 :             : 
      58                 :             : /**
      59                 :             :  * G_ALLOCATOR_NODE:
      60                 :             :  *
      61                 :             :  * Deprecated: 2.10
      62                 :             :  */
      63                 :             : 
      64                 :             : /**
      65                 :             :  * g_chunk_new:
      66                 :             :  *
      67                 :             :  * Deprecated: 2.10
      68                 :             :  */
      69                 :             : 
      70                 :             : /**
      71                 :             :  * g_chunk_new0:
      72                 :             :  *
      73                 :             :  * Deprecated: 2.10
      74                 :             :  */
      75                 :             : 
      76                 :             : /**
      77                 :             :  * g_chunk_free:
      78                 :             :  *
      79                 :             :  * Deprecated: 2.10
      80                 :             :  */
      81                 :             : 
      82                 :             : /**
      83                 :             :  * g_mem_chunk_create:
      84                 :             :  *
      85                 :             :  * Deprecated: 2.10
      86                 :             :  */
      87                 :             : 
      88                 :             : /**
      89                 :             :  * GMemChunk:
      90                 :             :  *
      91                 :             :  * Deprecated: 2.10
      92                 :             :  */
      93                 :             : struct _GMemChunk {
      94                 :             :   guint alloc_size;           /* the size of an atom */
      95                 :             : };
      96                 :             : 
      97                 :             : /**
      98                 :             :  * g_mem_chunk_new:
      99                 :             :  *
     100                 :             :  * Deprecated: 2.10
     101                 :             :  */
     102                 :             : GMemChunk*
     103                 :           1 : g_mem_chunk_new (const gchar *name,
     104                 :             :                  gint         atom_size,
     105                 :             :                  gsize        area_size,
     106                 :             :                  gint         type)
     107                 :             : {
     108                 :             :   GMemChunk *mem_chunk;
     109                 :             : 
     110                 :           1 :   g_return_val_if_fail (atom_size > 0, NULL);
     111                 :             : 
     112                 :           1 :   mem_chunk = g_slice_new (GMemChunk);
     113                 :           1 :   mem_chunk->alloc_size = (guint) atom_size;
     114                 :             : 
     115                 :           1 :   return mem_chunk;
     116                 :             : }
     117                 :             : 
     118                 :             : /**
     119                 :             :  * g_mem_chunk_destroy:
     120                 :             :  *
     121                 :             :  * Deprecated: 2.10
     122                 :             :  */
     123                 :             : void
     124                 :           1 : g_mem_chunk_destroy (GMemChunk *mem_chunk)
     125                 :             : {
     126                 :           1 :   g_return_if_fail (mem_chunk != NULL);
     127                 :             : 
     128                 :           1 :   g_slice_free (GMemChunk, mem_chunk);
     129                 :             : }
     130                 :             : 
     131                 :             : /**
     132                 :             :  * g_mem_chunk_alloc:
     133                 :             :  *
     134                 :             :  * Deprecated: 2.10
     135                 :             :  */
     136                 :             : gpointer
     137                 :       10000 : g_mem_chunk_alloc (GMemChunk *mem_chunk)
     138                 :             : {
     139                 :       10000 :   g_return_val_if_fail (mem_chunk != NULL, NULL);
     140                 :             : 
     141                 :       10000 :   return g_slice_alloc (mem_chunk->alloc_size);
     142                 :             : }
     143                 :             : 
     144                 :             : /**
     145                 :             :  * g_mem_chunk_alloc0:
     146                 :             :  *
     147                 :             :  * Deprecated: 2.10
     148                 :             :  */
     149                 :             : gpointer
     150                 :           0 : g_mem_chunk_alloc0 (GMemChunk *mem_chunk)
     151                 :             : {
     152                 :           0 :   g_return_val_if_fail (mem_chunk != NULL, NULL);
     153                 :             : 
     154                 :           0 :   return g_slice_alloc0 (mem_chunk->alloc_size);
     155                 :             : }
     156                 :             : 
     157                 :             : /**
     158                 :             :  * g_mem_chunk_free:
     159                 :             :  *
     160                 :             :  * Deprecated: 2.10
     161                 :             :  */
     162                 :             : void
     163                 :       10000 : g_mem_chunk_free (GMemChunk *mem_chunk,
     164                 :             :                   gpointer   mem)
     165                 :             : {
     166                 :       10000 :   g_return_if_fail (mem_chunk != NULL);
     167                 :             : 
     168                 :       10000 :   g_slice_free1 (mem_chunk->alloc_size, mem);
     169                 :             : }
     170                 :             : 
     171                 :             : /**
     172                 :             :  * g_allocator_new:
     173                 :             :  *
     174                 :             :  * Deprecated: 2.10
     175                 :             :  */
     176                 :             : GAllocator*
     177                 :           0 : g_allocator_new (const gchar *name,
     178                 :             :                  guint        n_preallocs)
     179                 :             : {
     180                 :             :   /* some (broken) GAllocator uses depend on non-NULL allocators */
     181                 :           0 :   return (void *) 1;
     182                 :             : }
     183                 :             : 
     184                 :             : /**
     185                 :             :  * g_allocator_free:
     186                 :             :  *
     187                 :             :  * Deprecated: 2.10
     188                 :             :  */
     189                 :           0 : void g_allocator_free           (GAllocator *allocator) { }
     190                 :             : 
     191                 :             : /**
     192                 :             :  * g_mem_chunk_clean:
     193                 :             :  *
     194                 :             :  * Deprecated: 2.10
     195                 :             :  */
     196                 :           0 : void g_mem_chunk_clean          (GMemChunk *mem_chunk)  { }
     197                 :             : 
     198                 :             : /**
     199                 :             :  * g_mem_chunk_reset:
     200                 :             :  *
     201                 :             :  * Deprecated: 2.10
     202                 :             :  */
     203                 :           0 : void g_mem_chunk_reset          (GMemChunk *mem_chunk)  { }
     204                 :             : 
     205                 :             : /**
     206                 :             :  * g_mem_chunk_print:
     207                 :             :  *
     208                 :             :  * Deprecated: 2.10
     209                 :             :  */
     210                 :           0 : void g_mem_chunk_print          (GMemChunk *mem_chunk)  { }
     211                 :             : 
     212                 :             : /**
     213                 :             :  * g_mem_chunk_info:
     214                 :             :  *
     215                 :             :  * Deprecated: 2.10
     216                 :             :  */
     217                 :           0 : void g_mem_chunk_info           (void)                  { }
     218                 :             : 
     219                 :             : /**
     220                 :             :  * g_blow_chunks:
     221                 :             :  *
     222                 :             :  * Deprecated: 2.10
     223                 :             :  */
     224                 :           0 : void g_blow_chunks              (void)                  { }
     225                 :             : 
     226                 :             : /**
     227                 :             :  * g_list_push_allocator:
     228                 :             :  *
     229                 :             :  * Deprecated: 2.10
     230                 :             :  */
     231                 :           0 : void g_list_push_allocator      (GAllocator *allocator) { }
     232                 :             : 
     233                 :             : /**
     234                 :             :  * g_list_pop_allocator:
     235                 :             :  *
     236                 :             :  * Deprecated: 2.10
     237                 :             :  */
     238                 :           0 : void g_list_pop_allocator       (void)                  { }
     239                 :             : 
     240                 :             : /**
     241                 :             :  * g_slist_push_allocator:
     242                 :             :  *
     243                 :             :  * Deprecated: 2.10
     244                 :             :  */
     245                 :           0 : void g_slist_push_allocator     (GAllocator *allocator) { }
     246                 :             : 
     247                 :             : /**
     248                 :             :  * g_slist_pop_allocator:
     249                 :             :  *
     250                 :             :  * Deprecated: 2.10
     251                 :             :  */
     252                 :           0 : void g_slist_pop_allocator      (void)                  { }
     253                 :             : 
     254                 :             : /**
     255                 :             :  * g_node_push_allocator:
     256                 :             :  *
     257                 :             :  * Deprecated: 2.10
     258                 :             :  */
     259                 :           0 : void g_node_push_allocator      (GAllocator *allocator) { }
     260                 :             : 
     261                 :             : /**
     262                 :             :  * g_node_pop_allocator:
     263                 :             :  *
     264                 :             :  * Deprecated: 2.10
     265                 :             :  */
     266                 :           0 : void g_node_pop_allocator       (void)                  { }
        

Generated by: LCOV version 2.0-1