* include/slang.h: comment out declaration of SLmemset(), SLmemchr(),

SLmemcpy(), SLmemcmp(), SLmalloc(), SLfree(), SLrealloc().
        * slcommon.c: comment out definitions of SLmalloc(), SLfree(),
        SLrealloc().
        * include/jdmacros.h: Fully rewritten to use glib rather than S-Lang
        replacements.
        * slmisc.c: Remove SLang_Version variable.
This commit is contained in:
Andrew V. Samoilov 2006-01-18 05:34:20 +00:00
parent 1504162feb
commit c5800b05f3
5 changed files with 44 additions and 49 deletions

View File

@ -1,3 +1,13 @@
2006-01-18 Pavel Shirshov <me@pavelsh.pp.ru>
* include/slang.h: comment out declaration of SLmemset(), SLmemchr(),
SLmemcpy(), SLmemcmp(), SLmalloc(), SLfree(), SLrealloc().
* slcommon.c: comment out definitions of SLmalloc(), SLfree(),
SLrealloc().
* include/jdmacros.h: Fully rewritten to use glib rather than S-Lang
replacements.
* slmisc.c: Remove SLang_Version variable.
2006-01-14 Pavel Shirshov <me@pavelsh.pp.ru> 2006-01-14 Pavel Shirshov <me@pavelsh.pp.ru>
* sldisply.c (SLtt_initialize): Fix typo. Change Is_Bg_BGR * sldisply.c (SLtt_initialize): Fix typo. Change Is_Bg_BGR

View File

@ -1,53 +1,15 @@
/* Fully rewritten to use glib rather than S-Lang replacements */
#ifndef _JD_MACROS_H_ #ifndef _JD_MACROS_H_
#define _JD_MACROS_H_ #define _JD_MACROS_H_
#ifndef SLMEMSET #include <glib.h>
# ifdef HAVE_MEMSET
# define SLMEMSET memset
# else
# define SLMEMSET SLmemset
# endif
#endif
#ifndef SLMEMCHR #define SLMEMSET(x,y,z) memset(x,y,z)
# ifdef HAVE_MEMCHR #define SLMEMCPY(x,y,z) memcpy(x,y,z)
# define SLMEMCHR memchr #define SLfree(x) g_free(x)
# else #define SLmalloc(x) g_malloc(x)
# define SLMEMCHR SLmemchr #define SLrealloc(x,y) g_realloc(x,y)
# endif #define SLvsnprintf g_vsnprintf
#endif
#ifndef SLMEMCPY #endif /* _JD_MACROS_H_ */
# ifdef HAVE_MEMCPY
# define SLMEMCPY memcpy
# else
# define SLMEMCPY SLmemcpy
# endif
#endif
/* Note: HAVE_MEMCMP requires an unsigned memory comparison!!! */
#ifndef SLMEMCMP
# ifdef HAVE_MEMCMP
# define SLMEMCMP memcmp
# else
# define SLMEMCMP SLmemcmp
# endif
#endif
#ifndef SLFREE
# define SLFREE free
#endif
#ifndef SLMALLOC
# define SLMALLOC malloc
#endif
#ifndef SLCALLOC
# define SLCALLOC calloc
#endif
#ifndef SLREALLOC
# define SLREALLOC realloc
#endif
#endif /* _JD_MACROS_H_ */

View File

@ -253,11 +253,17 @@ SL_EXTERN char *SLstrcpy(register char *, register char *);
SL_EXTERN int SLstrcmp(register char *, register char *); SL_EXTERN int SLstrcmp(register char *, register char *);
SL_EXTERN char *SLstrncpy(char *, register char *, register int); SL_EXTERN char *SLstrncpy(char *, register char *, register int);
/* GNU Midnight Commander uses replacements from glib */
#define MIDNIGHT_COMMANDER_CODE 1
#ifndef MIDNIGHT_COMMANDER_CODE
SL_EXTERN void SLmemset (char *, char, int); SL_EXTERN void SLmemset (char *, char, int);
SL_EXTERN char *SLmemchr (register char *, register char, register int); SL_EXTERN char *SLmemchr (register char *, register char, register int);
SL_EXTERN char *SLmemcpy (char *, char *, int); SL_EXTERN char *SLmemcpy (char *, char *, int);
SL_EXTERN int SLmemcmp (char *, char *, int); SL_EXTERN int SLmemcmp (char *, char *, int);
#endif /* !MIDNIGHT_COMMANDER_CODE */
/*}}}*/ /*}}}*/
/* SLstrings */ /* SLstrings */
@ -1274,11 +1280,23 @@ SL_EXTERN void SLbstring_free (SLang_BString_Type *);
SL_EXTERN int SLang_pop_bstring (SLang_BString_Type **); SL_EXTERN int SLang_pop_bstring (SLang_BString_Type **);
SL_EXTERN int SLang_push_bstring (SLang_BString_Type *); SL_EXTERN int SLang_push_bstring (SLang_BString_Type *);
/* GNU Midnight Commander uses replacements from glib */
#ifndef MIDNIGHT_COMMANDER_CODE
SL_EXTERN char *SLmalloc (unsigned int); SL_EXTERN char *SLmalloc (unsigned int);
#endif /* !MIDNIGHT_COMMANDER_CODE */
SL_EXTERN char *SLcalloc (unsigned int, unsigned int); SL_EXTERN char *SLcalloc (unsigned int, unsigned int);
#ifndef MIDNIGHT_COMMANDER_CODE
SL_EXTERN void SLfree(char *); /* This function handles NULL */ SL_EXTERN void SLfree(char *); /* This function handles NULL */
SL_EXTERN char *SLrealloc (char *, unsigned int); SL_EXTERN char *SLrealloc (char *, unsigned int);
#endif /* !MIDNIGHT_COMMANDER_CODE */
SL_EXTERN char *SLcurrent_time_string (void); SL_EXTERN char *SLcurrent_time_string (void);
SL_EXTERN int SLatoi(unsigned char *); SL_EXTERN int SLatoi(unsigned char *);

View File

@ -147,6 +147,8 @@ int SLutf8_enable (int mode)
return mode; return mode;
} }
#ifndef MIDNIGHT_COMMANDER_CODE
char *SLmalloc (unsigned int len) char *SLmalloc (unsigned int len)
{ {
char *p; char *p;
@ -181,6 +183,8 @@ char *SLrealloc (char *p, unsigned int len)
return p; return p;
} }
#endif /* !MIDNIGHT_COMMANDER_CODE */
char *SLcalloc (unsigned int nelems, unsigned int len) char *SLcalloc (unsigned int nelems, unsigned int len)
{ {
char *p; char *p;

View File

@ -24,9 +24,10 @@ USA.
#define _GNU_SOURCE #define _GNU_SOURCE
#include "slinclud.h" #include "slinclud.h"
#include <ctype.h>
#include "slang.h" #include "slang.h"
#include "_slang.h" #include "_slang.h"
int SLang_Version = SLANG_VERSION;
/* /*
* This function assumes that the initial \ char has been removed. * This function assumes that the initial \ char has been removed.