dotgnu-pnet-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[dotgnu-pnet-commits] [SCM] DotGNU Portable.NET Just In Time compiler (l


From: Aleksey Demakov
Subject: [dotgnu-pnet-commits] [SCM] DotGNU Portable.NET Just In Time compiler (libjit) branch, cache-refactoring, updated. 708d469c76e680b80b9caa6a1f5bb54242bf16a9
Date: Fri, 12 Oct 2012 18:53:47 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "DotGNU Portable.NET Just In Time compiler (libjit)".

The branch, cache-refactoring has been updated
       via  708d469c76e680b80b9caa6a1f5bb54242bf16a9 (commit)
      from  449f241ae151ee69d4d30116f236f43d85f4e533 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit/libjit.git/commit/?id=708d469c76e680b80b9caa6a1f5bb54242bf16a9

commit 708d469c76e680b80b9caa6a1f5bb54242bf16a9
Author: Aleksey Demakov <address@hidden>
Date:   Fri Oct 12 22:53:15 2012 +0400

    Move jit-string.c content to jit-util.c.

diff --git a/ChangeLog b/ChangeLog
index 4039cf3..66691b8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,7 +1,8 @@
 2012-10-12  Aleksey Demakov  <address@hidden>
 
        * jit/jit-memory.h: remove file.
-       * jit/jit-memory.c: rename to jit/jit-util.c
+       * jit/jit-memory.c: rename to jit/jit-util.c.
+       * jit/jit-string.c: append to jit/jit-util.c.
 
 2012-10-08  Aleksey Demakov  <address@hidden>
 
diff --git a/doc/Makefile.am b/doc/Makefile.am
index 36e809c..8f3e0f0 100644
--- a/doc/Makefile.am
+++ b/doc/Makefile.am
@@ -23,7 +23,6 @@ libjit_TEXINFOS = \
        $(srcdir)/libjitext-meta.texi \
        $(srcdir)/libjitext-reg-alloc.texi \
        $(srcdir)/libjitext-rules-interp.texi \
-       $(srcdir)/libjitext-string.texi \
        $(srcdir)/libjitext-type.texi \
        $(srcdir)/libjitext-value.texi \
        $(srcdir)/libjitext-walk.texi \
@@ -85,9 +84,6 @@ $(srcdir)/libjitext-reg-alloc.texi: 
$(top_srcdir)/jit/jit-reg-alloc.c
 $(srcdir)/libjitext-rules-interp.texi: $(top_srcdir)/jit/jit-rules-interp.c
        $(SHELL) $(srcdir)/extract-docs.sh $< >$@
 
-$(srcdir)/libjitext-string.texi: $(top_srcdir)/jit/jit-string.c
-       $(SHELL) $(srcdir)/extract-docs.sh $< >$@
-
 $(srcdir)/libjitext-type.texi: $(top_srcdir)/jit/jit-type.c
        $(SHELL) $(srcdir)/extract-docs.sh $< >$@
 
diff --git a/doc/libjit.texi b/doc/libjit.texi
index b67ec24..3e2c562 100644
--- a/doc/libjit.texi
+++ b/doc/libjit.texi
@@ -1059,7 +1059,6 @@ that it itself uses internally, but which may also be 
useful to front ends.
 
 @include libjitext-alloc.texi
 @include libjitext-util.texi
address@hidden libjitext-string.texi
 @include libjitext-meta.texi
 @include libjitext-apply.texi
 @include libjitext-walk.texi
diff --git a/jit/Makefile.am b/jit/Makefile.am
index 827925c..eda454c 100644
--- a/jit/Makefile.am
+++ b/jit/Makefile.am
@@ -68,7 +68,6 @@ libjit_la_SOURCES = \
        jit-rules-x86-64.c \
        jit-setjmp.h \
        jit-signal.c \
-       jit-string.c \
        jit-symbol.c \
        jit-thread.c \
        jit-thread.h \
diff --git a/jit/jit-string.c b/jit/jit-string.c
deleted file mode 100644
index 7deefbf..0000000
--- a/jit/jit-string.c
+++ /dev/null
@@ -1,401 +0,0 @@
-/*
- * jit-string.c - String handling routines.
- *
- * Copyright (C) 2004  Southern Storm Software, Pty Ltd.
- *
- * This file is part of the libjit library.
- *
- * The libjit library is free software: you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation, either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * The libjit library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the libjit library.  If not, see
- * <http://www.gnu.org/licenses/>.
- */
-
-#include <jit/jit-util.h>
-#include "jit-config.h"
-#ifdef HAVE_STRING_H
-       #include <string.h>
-#elif defined(HAVE_STRINGS_H)
-       #include <strings.h>
-#endif
-#include <stdio.h>
-#ifdef HAVE_STDARG_H
-       #include <stdarg.h>
-#elif HAVE_VARARGS_H
-       #include <varargs.h>
-#endif
-
-/*@
- * @section String operations
- * @cindex String operations
- *
- * The following functions are provided to manipulate NULL-terminated
- * strings.  It is highly recommended that you use these functions in
- * preference to system functions, because the corresponding system
- * functions are extremely non-portable.
address@hidden/
-
-/*@
- * @deftypefun {unsigned int} jit_strlen (const char address@hidden)
- * Returns the length of @var{str}.
- * @end deftypefun
address@hidden/
-unsigned int jit_strlen(const char *str)
-{
-#ifdef HAVE_STRLEN
-       return (unsigned int)(strlen(str));
-#else
-       unsigned int len = 0;
-       while(*str++ != '\0')
-       {
-               ++len;
-       }
-       return len;
-#endif
-}
-
-/*@
- * @deftypefun {char *} jit_strcpy (char address@hidden, const char 
address@hidden)
- * Copy the string at @var{src} to @var{dest}.  Returns @var{dest}.
- * @end deftypefun
address@hidden/
-char *jit_strcpy(char *dest, const char *src)
-{
-#ifdef HAVE_STRCPY
-       return strcpy(dest, src);
-#else
-       char ch;
-       char *d = dest;
-       while((ch = *src++) != '\0')
-       {
-               *d++ = ch;
-       }
-       *d = '\0';
-       return dest;
-#endif
-}
-
-/*@
- * @deftypefun {char *} jit_strcat (char address@hidden, const char 
address@hidden)
- * Copy the string at @var{src} to the end of the string at @var{dest}.
- * Returns @var{dest}.
- * @end deftypefun
address@hidden/
-char *jit_strcat(char *dest, const char *src)
-{
-#ifdef HAVE_STRCAT
-       return strcat(dest, src);
-#else
-       char ch;
-       char *d = dest + jit_strlen(dest);
-       while((ch = *src++) != '\0')
-       {
-               *d++ = ch;
-       }
-       *d = '\0';
-       return dest;
-#endif
-}
-
-/*@
- * @deftypefun {char *} jit_strncpy (char address@hidden, const char 
address@hidden, unsigned int @var{len})
- * Copy at most @var{len} characters from the string at @var{src} to
- * @var{dest}.  Returns @var{dest}.
- * @end deftypefun
address@hidden/
-char *jit_strncpy(char *dest, const char *src, unsigned int len)
-{
-#ifdef HAVE_STRNCPY
-       return strncpy(dest, src, len);
-#else
-       char ch;
-       char *d = dest;
-       while(len > 0 && (ch = *src++) != '\0')
-       {
-               *d++ = ch;
-               --len;
-       }
-       while(len > 0)
-       {
-               *d++ = '\0';
-               --len;
-       }
-       return dest;
-#endif
-}
-
-/*@
- * @deftypefun {char *} jit_strdup (const char address@hidden)
- * Allocate a block of memory using @code{jit_malloc} and copy
- * @var{str} into it.  Returns NULL if @var{str} is NULL or there
- * is insufficient memory to perform the @code{jit_malloc} operation.
- * @end deftypefun
address@hidden/
-char *jit_strdup(const char *str)
-{
-       char *new_str;
-       if(!str)
-       {
-               return 0;
-       }
-       new_str = jit_malloc(strlen(str) + 1);
-       if(!new_str)
-       {
-               return 0;
-       }
-       strcpy(new_str, str);
-       return new_str;
-}
-
-/*@
- * @deftypefun {char *} jit_strndup (const char address@hidden, unsigned int 
@var{len})
- * Allocate a block of memory using @code{jit_malloc} and copy at most
- * @var{len} characters of @var{str} into it.  The copied string is then
- * NULL-terminated.  Returns NULL if @var{str} is NULL or there
- * is insufficient memory to perform the @code{jit_malloc} operation.
- * @end deftypefun
address@hidden/
-char *jit_strndup(const char *str, unsigned int len)
-{
-       char *new_str;
-       if(!str)
-       {
-               return 0;
-       }
-       new_str = jit_malloc(len + 1);
-       if(!new_str)
-       {
-               return 0;
-       }
-       jit_memcpy(new_str, str, len);
-       new_str[len] = '\0';
-       return new_str;
-}
-
-/*@
- * @deftypefun int jit_strcmp (const char address@hidden, const char 
address@hidden)
- * Compare the two strings @var{str1} and @var{str2}, returning
- * a negative, zero, or positive value depending upon their relationship.
- * @end deftypefun
address@hidden/
-int jit_strcmp(const char *str1, const char *str2)
-{
-#ifdef HAVE_STRCMP
-       return strcmp(str1, str2);
-#else
-       int ch1, ch2;
-       for(;;)
-       {
-               ch1 = *str1++;
-               ch2 = *str2++;
-               if(ch1 != ch2 || !ch1 || !ch2)
-               {
-                       break;
-               }
-       }
-       return (ch1 - ch2);
-#endif
-}
-
-/*@
- * @deftypefun int jit_strncmp (const char address@hidden, const char 
address@hidden, unsigned int @var{len})
- * Compare the two strings @var{str1} and @var{str2}, returning
- * a negative, zero, or positive value depending upon their relationship.
- * At most @var{len} characters are compared.
- * @end deftypefun
address@hidden/
-int jit_strncmp(const char *str1, const char *str2, unsigned int len)
-{
-#ifdef HAVE_STRNCMP
-       return strncmp(str1, str2, len);
-#else
-       int ch1, ch2;
-       while(len > 0)
-       {
-               ch1 = *str1++;
-               ch2 = *str2++;
-               if(ch1 != ch2 || !ch1 || !ch2)
-               {
-                       return (ch1 - ch2);
-               }
-               --len;
-       }
-       return 0;
-#endif
-}
-
-/*@
- * @deftypefun int jit_stricmp (const char address@hidden, const char 
address@hidden)
- * Compare the two strings @var{str1} and @var{str2}, returning
- * a negative, zero, or positive value depending upon their relationship.
- * Instances of the English letters A to Z are converted into their
- * lower case counterparts before comparison.
- *
- * Note: this function is guaranteed to use English case comparison rules,
- * no matter what the current locale is set to, making it suitable for
- * comparing token tags and simple programming language identifiers.
- *
- * Locale-sensitive string comparison is complicated and usually specific
- * to the front end language or its supporting runtime library.  We
- * deliberately chose not to handle this in @code{libjit}.
- * @end deftypefun
address@hidden/
-int jit_stricmp(const char *str1, const char *str2)
-{
-       int ch1, ch2;
-       for(;;)
-       {
-               ch1 = *str1++;
-               ch2 = *str2++;
-               if(ch1 >= 'A' && ch1 <= 'Z')
-               {
-                       ch1 = ch1 - 'A' + 'a';
-               }
-               if(ch2 >= 'A' && ch2 <= 'Z')
-               {
-                       ch2 = ch2 - 'A' + 'a';
-               }
-               if(ch1 != ch2 || !ch1 || !ch2)
-               {
-                       break;
-               }
-       }
-       return (ch1 - ch2);
-}
-
-/*@
- * @deftypefun int jit_strnicmp (const char address@hidden, const char 
address@hidden, unsigned int @var{len})
- * Compare the two strings @var{str1} and @var{str2}, returning
- * a negative, zero, or positive value depending upon their relationship.
- * At most @var{len} characters are compared.  Instances of the English
- * letters A to Z are converted into their lower case counterparts
- * before comparison.
- * @end deftypefun
address@hidden/
-int jit_strnicmp(const char *str1, const char *str2, unsigned int len)
-{
-       int ch1, ch2;
-       while(len > 0)
-       {
-               ch1 = *str1++;
-               ch2 = *str2++;
-               if(ch1 >= 'A' && ch1 <= 'Z')
-               {
-                       ch1 = ch1 - 'A' + 'a';
-               }
-               if(ch2 >= 'A' && ch2 <= 'Z')
-               {
-                       ch2 = ch2 - 'A' + 'a';
-               }
-               if(ch1 != ch2 || !ch1 || !ch2)
-               {
-                       return (ch1 - ch2);
-               }
-               --len;
-       }
-       return 0;
-}
-
-/*@
- * @deftypefun {char *} jit_strchr (const char address@hidden, int @var{ch})
- * Search @var{str} for the first occurrence of @var{ch}.  Returns
- * the address where @var{ch} was found, or NULL if not found.
- * @end deftypefun
address@hidden/
-char *jit_strchr(const char *str, int ch)
-{
-#ifdef HAVE_STRCHR
-       return strchr(str, ch);
-#else
-       char *s = (char *)str;
-       for(;;)
-       {
-               if(*s == (char)ch)
-               {
-                       return s;
-               }
-               else if(*s == '\0')
-               {
-                       break;
-               }
-               ++s;
-       }
-       return 0;
-#endif
-}
-
-/*@
- * @deftypefun {char *} jit_strrchr (const char address@hidden, int @var{ch})
- * Search @var{str} for the first occurrence of @var{ch}, starting
- * at the end of the string.  Returns the address where @var{ch}
- * was found, or NULL if not found.
- * @end deftypefun
address@hidden/
-char *jit_strrchr(const char *str, int ch)
-{
-#ifdef HAVE_STRRCHR
-       return strrchr(str, ch);
-#else
-       unsigned int len = jit_strlen(str);
-       char *s = (char *)(str + len);
-       while(len > 0)
-       {
-               --s;
-               if(*s == (char)ch)
-               {
-                       return s;
-               }
-               --len;
-       }
-       return 0;
-#endif
-}
-
-int jit_sprintf(char *str, const char *format, ...)
-{
-       va_list va;
-       int result;
-#ifdef HAVE_STDARG_H
-       va_start(va, format);
-#else
-       va_start(va);
-#endif
-#ifdef VSPRINTF
-       result = vsprintf(str, format, va);
-#else
-       *str = '\0';
-       result = 0;
-#endif
-       va_end(va);
-       return result;
-}
-
-int jit_snprintf(char *str, unsigned int len, const char *format, ...)
-{
-       va_list va;
-       int result;
-#ifdef HAVE_STDARG_H
-       va_start(va, format);
-#else
-       va_start(va);
-#endif
-#if defined(HAVE_VSNPRINTF)
-       result = vsnprintf(str, len, format, va);
-#elif defined(HAVE__VSNPRINTF)
-       result = _vsnprintf(str, len, format, va);
-#else
-       *str = '\0';
-       result = 0;
-#endif
-       va_end(va);
-       return result;
-}
diff --git a/jit/jit-util.c b/jit/jit-util.c
index 662ea2b..9f2ec0c 100644
--- a/jit/jit-util.c
+++ b/jit/jit-util.c
@@ -20,7 +20,23 @@
  * <http://www.gnu.org/licenses/>.
  */
 
-#include "jit-internal.h"
+#include <jit/jit-util.h>
+#include "jit-config.h"
+
+#include <stdio.h>
+#if defined(HAVE_STRING_H)
+# include <string.h>
+#elif defined(HAVE_STRINGS_H)
+# include <strings.h>
+#endif
+#if defined(HAVE_MEMORY_H)
+# include <memory.h>
+#endif
+#if defined(HAVE_STDARG_H)
+# include <stdarg.h>
+#elif defined(HAVE_VARARGS_H)
+# include <varargs.h>
+#endif
 
 /*
  * Undefine the macros in "jit-internal.h" so that we
@@ -178,3 +194,369 @@ void *jit_memchr(const void *str, int ch, unsigned int 
len)
        return (void *)0;
 #endif
 }
+
+/*@
+ * @section String operations
+ * @cindex String operations
+ *
+ * The following functions are provided to manipulate NULL-terminated
+ * strings.  It is highly recommended that you use these functions in
+ * preference to system functions, because the corresponding system
+ * functions are extremely non-portable.
address@hidden/
+
+/*@
+ * @deftypefun {unsigned int} jit_strlen (const char address@hidden)
+ * Returns the length of @var{str}.
+ * @end deftypefun
address@hidden/
+unsigned int jit_strlen(const char *str)
+{
+#ifdef HAVE_STRLEN
+       return (unsigned int)(strlen(str));
+#else
+       unsigned int len = 0;
+       while(*str++ != '\0')
+       {
+               ++len;
+       }
+       return len;
+#endif
+}
+
+/*@
+ * @deftypefun {char *} jit_strcpy (char address@hidden, const char 
address@hidden)
+ * Copy the string at @var{src} to @var{dest}.  Returns @var{dest}.
+ * @end deftypefun
address@hidden/
+char *jit_strcpy(char *dest, const char *src)
+{
+#ifdef HAVE_STRCPY
+       return strcpy(dest, src);
+#else
+       char ch;
+       char *d = dest;
+       while((ch = *src++) != '\0')
+       {
+               *d++ = ch;
+       }
+       *d = '\0';
+       return dest;
+#endif
+}
+
+/*@
+ * @deftypefun {char *} jit_strcat (char address@hidden, const char 
address@hidden)
+ * Copy the string at @var{src} to the end of the string at @var{dest}.
+ * Returns @var{dest}.
+ * @end deftypefun
address@hidden/
+char *jit_strcat(char *dest, const char *src)
+{
+#ifdef HAVE_STRCAT
+       return strcat(dest, src);
+#else
+       char ch;
+       char *d = dest + jit_strlen(dest);
+       while((ch = *src++) != '\0')
+       {
+               *d++ = ch;
+       }
+       *d = '\0';
+       return dest;
+#endif
+}
+
+/*@
+ * @deftypefun {char *} jit_strncpy (char address@hidden, const char 
address@hidden, unsigned int @var{len})
+ * Copy at most @var{len} characters from the string at @var{src} to
+ * @var{dest}.  Returns @var{dest}.
+ * @end deftypefun
address@hidden/
+char *jit_strncpy(char *dest, const char *src, unsigned int len)
+{
+#ifdef HAVE_STRNCPY
+       return strncpy(dest, src, len);
+#else
+       char ch;
+       char *d = dest;
+       while(len > 0 && (ch = *src++) != '\0')
+       {
+               *d++ = ch;
+               --len;
+       }
+       while(len > 0)
+       {
+               *d++ = '\0';
+               --len;
+       }
+       return dest;
+#endif
+}
+
+/*@
+ * @deftypefun {char *} jit_strdup (const char address@hidden)
+ * Allocate a block of memory using @code{jit_malloc} and copy
+ * @var{str} into it.  Returns NULL if @var{str} is NULL or there
+ * is insufficient memory to perform the @code{jit_malloc} operation.
+ * @end deftypefun
address@hidden/
+char *jit_strdup(const char *str)
+{
+       char *new_str;
+       if(!str)
+       {
+               return 0;
+       }
+       new_str = jit_malloc(strlen(str) + 1);
+       if(!new_str)
+       {
+               return 0;
+       }
+       strcpy(new_str, str);
+       return new_str;
+}
+
+/*@
+ * @deftypefun {char *} jit_strndup (const char address@hidden, unsigned int 
@var{len})
+ * Allocate a block of memory using @code{jit_malloc} and copy at most
+ * @var{len} characters of @var{str} into it.  The copied string is then
+ * NULL-terminated.  Returns NULL if @var{str} is NULL or there
+ * is insufficient memory to perform the @code{jit_malloc} operation.
+ * @end deftypefun
address@hidden/
+char *jit_strndup(const char *str, unsigned int len)
+{
+       char *new_str;
+       if(!str)
+       {
+               return 0;
+       }
+       new_str = jit_malloc(len + 1);
+       if(!new_str)
+       {
+               return 0;
+       }
+       jit_memcpy(new_str, str, len);
+       new_str[len] = '\0';
+       return new_str;
+}
+
+/*@
+ * @deftypefun int jit_strcmp (const char address@hidden, const char 
address@hidden)
+ * Compare the two strings @var{str1} and @var{str2}, returning
+ * a negative, zero, or positive value depending upon their relationship.
+ * @end deftypefun
address@hidden/
+int jit_strcmp(const char *str1, const char *str2)
+{
+#ifdef HAVE_STRCMP
+       return strcmp(str1, str2);
+#else
+       int ch1, ch2;
+       for(;;)
+       {
+               ch1 = *str1++;
+               ch2 = *str2++;
+               if(ch1 != ch2 || !ch1 || !ch2)
+               {
+                       break;
+               }
+       }
+       return (ch1 - ch2);
+#endif
+}
+
+/*@
+ * @deftypefun int jit_strncmp (const char address@hidden, const char 
address@hidden, unsigned int @var{len})
+ * Compare the two strings @var{str1} and @var{str2}, returning
+ * a negative, zero, or positive value depending upon their relationship.
+ * At most @var{len} characters are compared.
+ * @end deftypefun
address@hidden/
+int jit_strncmp(const char *str1, const char *str2, unsigned int len)
+{
+#ifdef HAVE_STRNCMP
+       return strncmp(str1, str2, len);
+#else
+       int ch1, ch2;
+       while(len > 0)
+       {
+               ch1 = *str1++;
+               ch2 = *str2++;
+               if(ch1 != ch2 || !ch1 || !ch2)
+               {
+                       return (ch1 - ch2);
+               }
+               --len;
+       }
+       return 0;
+#endif
+}
+
+/*@
+ * @deftypefun int jit_stricmp (const char address@hidden, const char 
address@hidden)
+ * Compare the two strings @var{str1} and @var{str2}, returning
+ * a negative, zero, or positive value depending upon their relationship.
+ * Instances of the English letters A to Z are converted into their
+ * lower case counterparts before comparison.
+ *
+ * Note: this function is guaranteed to use English case comparison rules,
+ * no matter what the current locale is set to, making it suitable for
+ * comparing token tags and simple programming language identifiers.
+ *
+ * Locale-sensitive string comparison is complicated and usually specific
+ * to the front end language or its supporting runtime library.  We
+ * deliberately chose not to handle this in @code{libjit}.
+ * @end deftypefun
address@hidden/
+int jit_stricmp(const char *str1, const char *str2)
+{
+       int ch1, ch2;
+       for(;;)
+       {
+               ch1 = *str1++;
+               ch2 = *str2++;
+               if(ch1 >= 'A' && ch1 <= 'Z')
+               {
+                       ch1 = ch1 - 'A' + 'a';
+               }
+               if(ch2 >= 'A' && ch2 <= 'Z')
+               {
+                       ch2 = ch2 - 'A' + 'a';
+               }
+               if(ch1 != ch2 || !ch1 || !ch2)
+               {
+                       break;
+               }
+       }
+       return (ch1 - ch2);
+}
+
+/*@
+ * @deftypefun int jit_strnicmp (const char address@hidden, const char 
address@hidden, unsigned int @var{len})
+ * Compare the two strings @var{str1} and @var{str2}, returning
+ * a negative, zero, or positive value depending upon their relationship.
+ * At most @var{len} characters are compared.  Instances of the English
+ * letters A to Z are converted into their lower case counterparts
+ * before comparison.
+ * @end deftypefun
address@hidden/
+int jit_strnicmp(const char *str1, const char *str2, unsigned int len)
+{
+       int ch1, ch2;
+       while(len > 0)
+       {
+               ch1 = *str1++;
+               ch2 = *str2++;
+               if(ch1 >= 'A' && ch1 <= 'Z')
+               {
+                       ch1 = ch1 - 'A' + 'a';
+               }
+               if(ch2 >= 'A' && ch2 <= 'Z')
+               {
+                       ch2 = ch2 - 'A' + 'a';
+               }
+               if(ch1 != ch2 || !ch1 || !ch2)
+               {
+                       return (ch1 - ch2);
+               }
+               --len;
+       }
+       return 0;
+}
+
+/*@
+ * @deftypefun {char *} jit_strchr (const char address@hidden, int @var{ch})
+ * Search @var{str} for the first occurrence of @var{ch}.  Returns
+ * the address where @var{ch} was found, or NULL if not found.
+ * @end deftypefun
address@hidden/
+char *jit_strchr(const char *str, int ch)
+{
+#ifdef HAVE_STRCHR
+       return strchr(str, ch);
+#else
+       char *s = (char *)str;
+       for(;;)
+       {
+               if(*s == (char)ch)
+               {
+                       return s;
+               }
+               else if(*s == '\0')
+               {
+                       break;
+               }
+               ++s;
+       }
+       return 0;
+#endif
+}
+
+/*@
+ * @deftypefun {char *} jit_strrchr (const char address@hidden, int @var{ch})
+ * Search @var{str} for the first occurrence of @var{ch}, starting
+ * at the end of the string.  Returns the address where @var{ch}
+ * was found, or NULL if not found.
+ * @end deftypefun
address@hidden/
+char *jit_strrchr(const char *str, int ch)
+{
+#ifdef HAVE_STRRCHR
+       return strrchr(str, ch);
+#else
+       unsigned int len = jit_strlen(str);
+       char *s = (char *)(str + len);
+       while(len > 0)
+       {
+               --s;
+               if(*s == (char)ch)
+               {
+                       return s;
+               }
+               --len;
+       }
+       return 0;
+#endif
+}
+
+int jit_sprintf(char *str, const char *format, ...)
+{
+       va_list va;
+       int result;
+#ifdef HAVE_STDARG_H
+       va_start(va, format);
+#else
+       va_start(va);
+#endif
+#ifdef VSPRINTF
+       result = vsprintf(str, format, va);
+#else
+       *str = '\0';
+       result = 0;
+#endif
+       va_end(va);
+       return result;
+}
+
+int jit_snprintf(char *str, unsigned int len, const char *format, ...)
+{
+       va_list va;
+       int result;
+#ifdef HAVE_STDARG_H
+       va_start(va, format);
+#else
+       va_start(va);
+#endif
+#if defined(HAVE_VSNPRINTF)
+       result = vsnprintf(str, len, format, va);
+#elif defined(HAVE__VSNPRINTF)
+       result = _vsnprintf(str, len, format, va);
+#else
+       *str = '\0';
+       result = 0;
+#endif
+       va_end(va);
+       return result;
+}

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog        |    3 +-
 doc/Makefile.am  |    4 -
 doc/libjit.texi  |    1 -
 jit/Makefile.am  |    1 -
 jit/jit-string.c |  401 ------------------------------------------------------
 jit/jit-util.c   |  384 +++++++++++++++++++++++++++++++++++++++++++++++++++-
 6 files changed, 385 insertions(+), 409 deletions(-)
 delete mode 100644 jit/jit-string.c


hooks/post-receive
-- 
DotGNU Portable.NET Just In Time compiler (libjit)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]