summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordiego <diego@b3059339-0415-0410-9bf9-f77b7e298cf2>2010-10-01 18:29:35 +0000
committerUoti Urpala <uau@glyph.nonexistent.invalid>2010-11-02 04:18:08 +0200
commit69e3e06a1ab7c58b16294d0c7451b374e5966e21 (patch)
tree2505424106c7b90448262cc3bdc3f73b699ccf32
parentb44a0edd9fd1d88e7d114c3ba1f34662127981ad (diff)
downloadmpv-69e3e06a1ab7c58b16294d0c7451b374e5966e21.tar.bz2
mpv-69e3e06a1ab7c58b16294d0c7451b374e5966e21.tar.xz
Move code to avoid forward declarations in top-level .c files
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32421 b3059339-0415-0410-9bf9-f77b7e298cf2
-rw-r--r--cpudetect.c336
-rw-r--r--m_option.c36
-rw-r--r--sub_cc.c16
-rw-r--r--subopt-helper.c135
4 files changed, 259 insertions, 264 deletions
diff --git a/cpudetect.c b/cpudetect.c
index d394bdcdab..343d2ac25b 100644
--- a/cpudetect.c
+++ b/cpudetect.c
@@ -54,7 +54,174 @@ CpuCaps gCpuCaps;
/* I believe this code works. However, it has only been used on a PII and PIII */
-static void check_os_katmai_support( void );
+#if defined(__linux__) && defined(_POSIX_SOURCE) && !ARCH_X86_64
+static void sigill_handler_sse( int signal, struct sigcontext sc )
+{
+ mp_msg(MSGT_CPUDETECT,MSGL_V, "SIGILL, " );
+
+ /* Both the "xorps %%xmm0,%%xmm0" and "divps %xmm0,%%xmm1"
+ * instructions are 3 bytes long. We must increment the instruction
+ * pointer manually to avoid repeated execution of the offending
+ * instruction.
+ *
+ * If the SIGILL is caused by a divide-by-zero when unmasked
+ * exceptions aren't supported, the SIMD FPU status and control
+ * word will be restored at the end of the test, so we don't need
+ * to worry about doing it here. Besides, we may not be able to...
+ */
+ sc.eip += 3;
+
+ gCpuCaps.hasSSE=0;
+}
+#endif /* __linux__ && _POSIX_SOURCE */
+
+#if (defined(__MINGW32__) || defined(__CYGWIN__)) && !ARCH_X86_64
+LONG CALLBACK win32_sig_handler_sse(EXCEPTION_POINTERS* ep)
+{
+ if(ep->ExceptionRecord->ExceptionCode==EXCEPTION_ILLEGAL_INSTRUCTION){
+ mp_msg(MSGT_CPUDETECT,MSGL_V, "SIGILL, " );
+ ep->ContextRecord->Eip +=3;
+ gCpuCaps.hasSSE=0;
+ return EXCEPTION_CONTINUE_EXECUTION;
+ }
+ return EXCEPTION_CONTINUE_SEARCH;
+}
+#endif /* defined(__MINGW32__) || defined(__CYGWIN__) */
+
+#ifdef __OS2__
+ULONG _System os2_sig_handler_sse(PEXCEPTIONREPORTRECORD p1,
+ PEXCEPTIONREGISTRATIONRECORD p2,
+ PCONTEXTRECORD p3,
+ PVOID p4)
+{
+ if(p1->ExceptionNum == XCPT_ILLEGAL_INSTRUCTION){
+ mp_msg(MSGT_CPUDETECT, MSGL_V, "SIGILL, ");
+
+ p3->ctx_RegEip += 3;
+ gCpuCaps.hasSSE = 0;
+
+ return XCPT_CONTINUE_EXECUTION;
+ }
+ return XCPT_CONTINUE_SEARCH;
+}
+#endif
+
+/* If we're running on a processor that can do SSE, let's see if we
+ * are allowed to or not. This will catch 2.4.0 or later kernels that
+ * haven't been configured for a Pentium III but are running on one,
+ * and RedHat patched 2.2 kernels that have broken exception handling
+ * support for user space apps that do SSE.
+ */
+
+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
+#define SSE_SYSCTL_NAME "hw.instruction_sse"
+#elif defined(__APPLE__)
+#define SSE_SYSCTL_NAME "hw.optional.sse"
+#endif
+
+static void check_os_katmai_support( void )
+{
+#if ARCH_X86_64
+ gCpuCaps.hasSSE=1;
+ gCpuCaps.hasSSE2=1;
+#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) || defined(__APPLE__)
+ int has_sse=0, ret;
+ size_t len=sizeof(has_sse);
+
+ ret = sysctlbyname(SSE_SYSCTL_NAME, &has_sse, &len, NULL, 0);
+ if (ret || !has_sse)
+ gCpuCaps.hasSSE=0;
+
+#elif defined(__NetBSD__) || defined (__OpenBSD__)
+#if __NetBSD_Version__ >= 105250000 || (defined __OpenBSD__)
+ int has_sse, has_sse2, ret, mib[2];
+ size_t varlen;
+
+ mib[0] = CTL_MACHDEP;
+ mib[1] = CPU_SSE;
+ varlen = sizeof(has_sse);
+
+ mp_msg(MSGT_CPUDETECT,MSGL_V, "Testing OS support for SSE... " );
+ ret = sysctl(mib, 2, &has_sse, &varlen, NULL, 0);
+ gCpuCaps.hasSSE = ret >= 0 && has_sse;
+ mp_msg(MSGT_CPUDETECT,MSGL_V, gCpuCaps.hasSSE ? "yes.\n" : "no!\n" );
+
+ mib[1] = CPU_SSE2;
+ varlen = sizeof(has_sse2);
+ mp_msg(MSGT_CPUDETECT,MSGL_V, "Testing OS support for SSE2... " );
+ ret = sysctl(mib, 2, &has_sse2, &varlen, NULL, 0);
+ gCpuCaps.hasSSE2 = ret >= 0 && has_sse2;
+ mp_msg(MSGT_CPUDETECT,MSGL_V, gCpuCaps.hasSSE2 ? "yes.\n" : "no!\n" );
+#else
+ gCpuCaps.hasSSE = 0;
+ mp_msg(MSGT_CPUDETECT,MSGL_WARN, "No OS support for SSE, disabling to be safe.\n" );
+#endif
+#elif defined(__MINGW32__) || defined(__CYGWIN__)
+ LPTOP_LEVEL_EXCEPTION_FILTER exc_fil;
+ if ( gCpuCaps.hasSSE ) {
+ mp_msg(MSGT_CPUDETECT,MSGL_V, "Testing OS support for SSE... " );
+ exc_fil = SetUnhandledExceptionFilter(win32_sig_handler_sse);
+ __asm__ volatile ("xorps %xmm0, %xmm0");
+ SetUnhandledExceptionFilter(exc_fil);
+ mp_msg(MSGT_CPUDETECT,MSGL_V, gCpuCaps.hasSSE ? "yes.\n" : "no!\n" );
+ }
+#elif defined(__OS2__)
+ EXCEPTIONREGISTRATIONRECORD RegRec = { 0, &os2_sig_handler_sse };
+ if ( gCpuCaps.hasSSE ) {
+ mp_msg(MSGT_CPUDETECT,MSGL_V, "Testing OS support for SSE... " );
+ DosSetExceptionHandler( &RegRec );
+ __asm__ volatile ("xorps %xmm0, %xmm0");
+ DosUnsetExceptionHandler( &RegRec );
+ mp_msg(MSGT_CPUDETECT,MSGL_V, gCpuCaps.hasSSE ? "yes.\n" : "no!\n" );
+ }
+#elif defined(__linux__)
+#if defined(_POSIX_SOURCE)
+ struct sigaction saved_sigill;
+
+ /* Save the original signal handlers.
+ */
+ sigaction( SIGILL, NULL, &saved_sigill );
+
+ signal( SIGILL, (void (*)(int))sigill_handler_sse );
+
+ /* Emulate test for OSFXSR in CR4. The OS will set this bit if it
+ * supports the extended FPU save and restore required for SSE. If
+ * we execute an SSE instruction on a PIII and get a SIGILL, the OS
+ * doesn't support Streaming SIMD Exceptions, even if the processor
+ * does.
+ */
+ if ( gCpuCaps.hasSSE ) {
+ mp_msg(MSGT_CPUDETECT,MSGL_V, "Testing OS support for SSE... " );
+
+// __asm__ volatile ("xorps %%xmm0, %%xmm0");
+ __asm__ volatile ("xorps %xmm0, %xmm0");
+
+ mp_msg(MSGT_CPUDETECT,MSGL_V, gCpuCaps.hasSSE ? "yes.\n" : "no!\n" );
+ }
+
+ /* Restore the original signal handlers.
+ */
+ sigaction( SIGILL, &saved_sigill, NULL );
+
+ /* If we've gotten to here and the XMM CPUID bit is still set, we're
+ * safe to go ahead and hook out the SSE code throughout Mesa.
+ */
+ mp_msg(MSGT_CPUDETECT,MSGL_V, "Tests of OS support for SSE %s\n", gCpuCaps.hasSSE ? "passed." : "failed!" );
+#else
+ /* We can't use POSIX signal handling to test the availability of
+ * SSE, so we disable it by default.
+ */
+ mp_msg(MSGT_CPUDETECT,MSGL_WARN, "Cannot test OS support for SSE, disabling to be safe.\n" );
+ gCpuCaps.hasSSE=0;
+#endif /* _POSIX_SOURCE */
+#else
+ /* Do nothing on other platforms for now.
+ */
+ mp_msg(MSGT_CPUDETECT,MSGL_WARN, "Cannot test OS support for SSE, leaving disabled.\n" );
+ gCpuCaps.hasSSE=0;
+#endif /* __linux__ */
+}
+
// return TRUE if cpuid supported
static int has_cpuid(void)
@@ -248,173 +415,6 @@ char *GetCpuFriendlyName(unsigned int regs[], unsigned int regs2[]){
return retname;
}
-#if defined(__linux__) && defined(_POSIX_SOURCE) && !ARCH_X86_64
-static void sigill_handler_sse( int signal, struct sigcontext sc )
-{
- mp_msg(MSGT_CPUDETECT,MSGL_V, "SIGILL, " );
-
- /* Both the "xorps %%xmm0,%%xmm0" and "divps %xmm0,%%xmm1"
- * instructions are 3 bytes long. We must increment the instruction
- * pointer manually to avoid repeated execution of the offending
- * instruction.
- *
- * If the SIGILL is caused by a divide-by-zero when unmasked
- * exceptions aren't supported, the SIMD FPU status and control
- * word will be restored at the end of the test, so we don't need
- * to worry about doing it here. Besides, we may not be able to...
- */
- sc.eip += 3;
-
- gCpuCaps.hasSSE=0;
-}
-#endif /* __linux__ && _POSIX_SOURCE */
-
-#if (defined(__MINGW32__) || defined(__CYGWIN__)) && !ARCH_X86_64
-LONG CALLBACK win32_sig_handler_sse(EXCEPTION_POINTERS* ep)
-{
- if(ep->ExceptionRecord->ExceptionCode==EXCEPTION_ILLEGAL_INSTRUCTION){
- mp_msg(MSGT_CPUDETECT,MSGL_V, "SIGILL, " );
- ep->ContextRecord->Eip +=3;
- gCpuCaps.hasSSE=0;
- return EXCEPTION_CONTINUE_EXECUTION;
- }
- return EXCEPTION_CONTINUE_SEARCH;
-}
-#endif /* defined(__MINGW32__) || defined(__CYGWIN__) */
-
-#ifdef __OS2__
-ULONG _System os2_sig_handler_sse(PEXCEPTIONREPORTRECORD p1,
- PEXCEPTIONREGISTRATIONRECORD p2,
- PCONTEXTRECORD p3,
- PVOID p4)
-{
- if(p1->ExceptionNum == XCPT_ILLEGAL_INSTRUCTION){
- mp_msg(MSGT_CPUDETECT, MSGL_V, "SIGILL, ");
-
- p3->ctx_RegEip += 3;
- gCpuCaps.hasSSE = 0;
-
- return XCPT_CONTINUE_EXECUTION;
- }
- return XCPT_CONTINUE_SEARCH;
-}
-#endif
-
-/* If we're running on a processor that can do SSE, let's see if we
- * are allowed to or not. This will catch 2.4.0 or later kernels that
- * haven't been configured for a Pentium III but are running on one,
- * and RedHat patched 2.2 kernels that have broken exception handling
- * support for user space apps that do SSE.
- */
-
-#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
-#define SSE_SYSCTL_NAME "hw.instruction_sse"
-#elif defined(__APPLE__)
-#define SSE_SYSCTL_NAME "hw.optional.sse"
-#endif
-
-static void check_os_katmai_support( void )
-{
-#if ARCH_X86_64
- gCpuCaps.hasSSE=1;
- gCpuCaps.hasSSE2=1;
-#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) || defined(__APPLE__)
- int has_sse=0, ret;
- size_t len=sizeof(has_sse);
-
- ret = sysctlbyname(SSE_SYSCTL_NAME, &has_sse, &len, NULL, 0);
- if (ret || !has_sse)
- gCpuCaps.hasSSE=0;
-
-#elif defined(__NetBSD__) || defined (__OpenBSD__)
-#if __NetBSD_Version__ >= 105250000 || (defined __OpenBSD__)
- int has_sse, has_sse2, ret, mib[2];
- size_t varlen;
-
- mib[0] = CTL_MACHDEP;
- mib[1] = CPU_SSE;
- varlen = sizeof(has_sse);
-
- mp_msg(MSGT_CPUDETECT,MSGL_V, "Testing OS support for SSE... " );
- ret = sysctl(mib, 2, &has_sse, &varlen, NULL, 0);
- gCpuCaps.hasSSE = ret >= 0 && has_sse;
- mp_msg(MSGT_CPUDETECT,MSGL_V, gCpuCaps.hasSSE ? "yes.\n" : "no!\n" );
-
- mib[1] = CPU_SSE2;
- varlen = sizeof(has_sse2);
- mp_msg(MSGT_CPUDETECT,MSGL_V, "Testing OS support for SSE2... " );
- ret = sysctl(mib, 2, &has_sse2, &varlen, NULL, 0);
- gCpuCaps.hasSSE2 = ret >= 0 && has_sse2;
- mp_msg(MSGT_CPUDETECT,MSGL_V, gCpuCaps.hasSSE2 ? "yes.\n" : "no!\n" );
-#else
- gCpuCaps.hasSSE = 0;
- mp_msg(MSGT_CPUDETECT,MSGL_WARN, "No OS support for SSE, disabling to be safe.\n" );
-#endif
-#elif defined(__MINGW32__) || defined(__CYGWIN__)
- LPTOP_LEVEL_EXCEPTION_FILTER exc_fil;
- if ( gCpuCaps.hasSSE ) {
- mp_msg(MSGT_CPUDETECT,MSGL_V, "Testing OS support for SSE... " );
- exc_fil = SetUnhandledExceptionFilter(win32_sig_handler_sse);
- __asm__ volatile ("xorps %xmm0, %xmm0");
- SetUnhandledExceptionFilter(exc_fil);
- mp_msg(MSGT_CPUDETECT,MSGL_V, gCpuCaps.hasSSE ? "yes.\n" : "no!\n" );
- }
-#elif defined(__OS2__)
- EXCEPTIONREGISTRATIONRECORD RegRec = { 0, &os2_sig_handler_sse };
- if ( gCpuCaps.hasSSE ) {
- mp_msg(MSGT_CPUDETECT,MSGL_V, "Testing OS support for SSE... " );
- DosSetExceptionHandler( &RegRec );
- __asm__ volatile ("xorps %xmm0, %xmm0");
- DosUnsetExceptionHandler( &RegRec );
- mp_msg(MSGT_CPUDETECT,MSGL_V, gCpuCaps.hasSSE ? "yes.\n" : "no!\n" );
- }
-#elif defined(__linux__)
-#if defined(_POSIX_SOURCE)
- struct sigaction saved_sigill;
-
- /* Save the original signal handlers.
- */
- sigaction( SIGILL, NULL, &saved_sigill );
-
- signal( SIGILL, (void (*)(int))sigill_handler_sse );
-
- /* Emulate test for OSFXSR in CR4. The OS will set this bit if it
- * supports the extended FPU save and restore required for SSE. If
- * we execute an SSE instruction on a PIII and get a SIGILL, the OS
- * doesn't support Streaming SIMD Exceptions, even if the processor
- * does.
- */
- if ( gCpuCaps.hasSSE ) {
- mp_msg(MSGT_CPUDETECT,MSGL_V, "Testing OS support for SSE... " );
-
-// __asm__ volatile ("xorps %%xmm0, %%xmm0");
- __asm__ volatile ("xorps %xmm0, %xmm0");
-
- mp_msg(MSGT_CPUDETECT,MSGL_V, gCpuCaps.hasSSE ? "yes.\n" : "no!\n" );
- }
-
- /* Restore the original signal handlers.
- */
- sigaction( SIGILL, &saved_sigill, NULL );
-
- /* If we've gotten to here and the XMM CPUID bit is still set, we're
- * safe to go ahead and hook out the SSE code throughout Mesa.
- */
- mp_msg(MSGT_CPUDETECT,MSGL_V, "Tests of OS support for SSE %s\n", gCpuCaps.hasSSE ? "passed." : "failed!" );
-#else
- /* We can't use POSIX signal handling to test the availability of
- * SSE, so we disable it by default.
- */
- mp_msg(MSGT_CPUDETECT,MSGL_WARN, "Cannot test OS support for SSE, disabling to be safe.\n" );
- gCpuCaps.hasSSE=0;
-#endif /* _POSIX_SOURCE */
-#else
- /* Do nothing on other platforms for now.
- */
- mp_msg(MSGT_CPUDETECT,MSGL_WARN, "Cannot test OS support for SSE, leaving disabled.\n" );
- gCpuCaps.hasSSE=0;
-#endif /* __linux__ */
-}
#else /* ARCH_X86 */
#ifdef __APPLE__
diff --git a/m_option.c b/m_option.c
index 4e8a776d26..b1b37ffc87 100644
--- a/m_option.c
+++ b/m_option.c
@@ -1677,8 +1677,6 @@ static int parse_obj_settings(const char* opt,char* str,const m_obj_list_t* list
return 1;
}
-static void free_obj_settings_list(void* dst);
-
static int obj_settings_list_del(const char *opt_name,const char *param,void* dst, int src) {
char** str_list = NULL;
int r,i,idx_max = 0;
@@ -1737,6 +1735,23 @@ static int obj_settings_list_del(const char *opt_name,const char *param,void* ds
return 1;
}
+static void free_obj_settings_list(void* dst) {
+ int n;
+ m_obj_settings_t *d;
+
+ if (!dst || !VAL(dst)) return;
+
+ d = VAL(dst);
+#ifndef NO_FREE
+ for (n = 0 ; d[n].name ; n++) {
+ free(d[n].name);
+ free_str_list(&(d[n].attribs));
+ }
+ free(d);
+#endif
+ VAL(dst) = NULL;
+}
+
static int parse_obj_settings_list(const m_option_t* opt,const char *name,
const char *param, void* dst, int src) {
int n = 0,r,len = strlen(opt->name);
@@ -1874,23 +1889,6 @@ static int parse_obj_settings_list(const m_option_t* opt,const char *name,
return 1;
}
-static void free_obj_settings_list(void* dst) {
- int n;
- m_obj_settings_t *d;
-
- if(!dst || !VAL(dst)) return;
-
- d = VAL(dst);
-#ifndef NO_FREE
- for(n = 0 ; d[n].name ; n++) {
- free(d[n].name);
- free_str_list(&(d[n].attribs));
- }
- free(d);
-#endif
- VAL(dst) = NULL;
-}
-
static void copy_obj_settings_list(const m_option_t* opt,void* dst, const void* src) {
m_obj_settings_t *d,*s;
int n;
diff --git a/sub_cc.c b/sub_cc.c
index 53502a3d62..51959e029a 100644
--- a/sub_cc.c
+++ b/sub_cc.c
@@ -58,8 +58,6 @@ static int initialized=0;
static int cc_mode=CC_ROLLON;
static int cc_lines=4; ///< number of visible rows in CC roll-up mode, not used in CC roll-on mode
-static void display_buffer(subtitle * buf);
-
static void build_char_table(void)
{
int i;
@@ -120,6 +118,14 @@ void subcc_init(void)
initialized=1;
}
+
+static void display_buffer(subtitle *buf)
+{
+ vo_sub = buf;
+ vo_osd_changed(OSDTYPE_SUBTITLE);
+}
+
+
static void append_char(char c)
{
if(!bb->lines) {bb->lines++; cursor_pos=0;}
@@ -163,12 +169,6 @@ static void swap_buffers(void)
bb=foo;
}
-static void display_buffer(subtitle * buf)
-{
- vo_sub=buf;
- vo_osd_changed(OSDTYPE_SUBTITLE);
-}
-
static void cc_decode_EIA608(unsigned short int data)
{
diff --git a/subopt-helper.c b/subopt-helper.c
index 31cedeef6c..37c634b5ff 100644
--- a/subopt-helper.c
+++ b/subopt-helper.c
@@ -47,10 +47,72 @@
#define NDEBUG
#endif
-/* prototypes for argument parsing */
-static char const * parse_int( char const * const str, int * const valp );
-static char const * parse_str( char const * const str, strarg_t * const valp );
-static char const * parse_float( char const * const str, float * const valp );
+
+static char const * parse_int( char const * const str, int * const valp )
+{
+ char * endp;
+
+ assert( str && "parse_int(): str == NULL" );
+
+ *valp = (int)strtol( str, &endp, 0 );
+
+ /* nothing was converted */
+ if ( str == endp ) { return NULL; }
+
+ return endp;
+}
+
+static char const * parse_float( char const * const str, float * const valp )
+{
+ char * endp;
+
+ assert( str && "parse_float(): str == NULL" );
+
+ *valp = strtod( str, &endp );
+
+ /* nothing was converted */
+ if ( str == endp ) { return NULL; }
+
+ return endp;
+}
+
+#define QUOTE_CHAR '%'
+static char const * parse_str( char const * str, strarg_t * const valp )
+{
+ char const * match = strchr( str, ':' );
+
+ if (str[0] == QUOTE_CHAR) {
+ int len = 0;
+ str = &str[1];
+ len = (int)strtol(str, (char **)&str, 0);
+ if (!str || str[0] != QUOTE_CHAR || (len > strlen(str) - 1))
+ return NULL;
+ str = &str[1];
+ match = &str[len];
+ }
+ else
+ if (str[0] == '"') {
+ str = &str[1];
+ match = strchr(str, '"');
+ if (!match)
+ return NULL;
+ valp->len = match - str;
+ valp->str = str;
+ return &match[1];
+ }
+ if ( !match )
+ match = &str[strlen(str)];
+
+ // empty string or too long
+ if ((match == str) || (match - str > INT_MAX))
+ return NULL;
+
+ valp->len = match - str;
+ valp->str = str;
+
+ return match;
+}
+
/**
* \brief Try to parse all options in str and fail if it was not possible.
@@ -249,71 +311,6 @@ else if ( substr_len == opt_len+2 )
return 0;
}
-static char const * parse_int( char const * const str, int * const valp )
-{
- char * endp;
-
- assert( str && "parse_int(): str == NULL" );
-
- *valp = (int)strtol( str, &endp, 0 );
-
- /* nothing was converted */
- if ( str == endp ) { return NULL; }
-
- return endp;
-}
-
-static char const * parse_float( char const * const str, float * const valp )
-{
- char * endp;
-
- assert( str && "parse_float(): str == NULL" );
-
- *valp = strtod( str, &endp );
-
- /* nothing was converted */
- if ( str == endp ) { return NULL; }
-
- return endp;
-}
-
-#define QUOTE_CHAR '%'
-static char const * parse_str( char const * str, strarg_t * const valp )
-{
- char const * match = strchr( str, ':' );
-
- if (str[0] == QUOTE_CHAR) {
- int len = 0;
- str = &str[1];
- len = (int)strtol(str, (char **)&str, 0);
- if (!str || str[0] != QUOTE_CHAR || (len > strlen(str) - 1))
- return NULL;
- str = &str[1];
- match = &str[len];
- }
- else
- if (str[0] == '"') {
- str = &str[1];
- match = strchr(str, '"');
- if (!match)
- return NULL;
- valp->len = match - str;
- valp->str = str;
- return &match[1];
- }
- if ( !match )
- match = &str[strlen(str)];
-
- // empty string or too long
- if ((match == str) || (match - str > INT_MAX))
- return NULL;
-
- valp->len = match - str;
- valp->str = str;
-
- return match;
-}
-
/*** common test functions ***/