source: git/factory/mmallocs.c @ 160f8f7

fieker-DuValspielwiese
Last change on this file since 160f8f7 was 9d7aaa, checked in by Jens Schmidt <schmidt@…>, 27 years ago
#include <config.h> added git-svn-id: file:///usr/local/Singular/svn/trunk@155 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 1.3 KB
Line 
1/* emacs edit mode for this file is -*- C -*- */
2/* $Id: mmallocs.c,v 1.1 1997-04-15 09:24:06 schmidt Exp $ */
3
4/*
5$Log: not supported by cvs2svn $
6Revision 1.0  1996/05/17 10:59:48  stobbe
7Initial revision
8
9*/
10
11#define _POSIX_SOURCE 1
12
13#include <config.h>
14
15#include <stdlib.h>
16#include <stdio.h>
17
18#include "memman.h"
19#include "mmprivate.h"
20
21#ifndef MDEBUG
22
23void *
24mmAllocSpecialized( void )
25{
26    mcb result;
27
28    if ( mm_theList[mm_specIndex] == NULL )
29        return mmAllocBlock( mmGetSize( mm_specIndex ) );
30    result = mm_theList[mm_specIndex];
31    mm_theList[mm_specIndex] = (mcb)*result;
32#ifdef MM_COUNT
33    mm_bytesUsed += mmGetSize( mm_specIndex );
34#endif
35    return (void*)result;
36}
37
38void
39mmFreeSpecialized( void* adr )
40{
41    *((mcb)adr) = mm_theList[mm_specIndex];
42    mm_theList[mm_specIndex] = (mcb)adr;
43#ifdef MM_COUNT
44    mm_bytesUsed -= mmGetSize( mm_specIndex );
45#endif
46}
47
48#else /* MDEBUG */
49
50void *
51mmDBAllocSpecialized( char* fname, int lineno )
52{
53    return mmDBAllocBlock( mm_specSize, fname, lineno );
54}
55
56void
57mmDBFreeSpecialized( void* adr, char* fname, int lineno )
58{
59    mmDBFreeBlock( adr, mm_specSize, fname, lineno );
60}
61
62#endif /* MDEBUG */
63
64
65void
66mmSpecializeBlock( size_t size )
67{
68    mm_specIndex = mmGetIndex( size );
69    if (mm_specIndex<0) {
70        fprintf(stderr,"too many ring variables\nleaving Singular...");
71        exit(11);
72    }
73    mm_specSize = size;
74}
Note: See TracBrowser for help on using the repository browser.