* *
* partial sync with the 3.4 fork codebase. These are the things
synces for the most part:
- copyright headers
- grammar/typos in comments and some readmes
- comment/whitespace/decorations
- variable scoping in C files
- DO CASE/SWITCH and some other alternate syntax usage
- minimal amount of human readable text in strings
- minor code updates
- HB_TRACE() void * casts for pointers and few other changes to
avoid C compiler warnings
- various other, minor code cleanups
- only Harbour/C code/headers were touched in src, utils, contrib,
include. No 3rd party code, no make files, and with just a few
exceptions, no 'tests' code was touched.
- certain components were not touched were 3.4 diverged too much
already, like f.e. hbmk2, hbssl, hbcurl, hbexpat
- the goal was that no actual program logic should be altered by
these changes. Except some possible minor exceptions, any such
change is probably a bug in this patch.
It's a massive patch, if you find anything broken after it, please
open an Issue with the details. Build test was done on macOS.
The goal is make it easier to see what actual code/logic was changed
in 3.4 compared to 3.2 and to make patches easier to apply in both
ways.
43 lines
875 B
C
43 lines
875 B
C
/*
|
|
* BBS.......: The Dark Knight Returns
|
|
* Date......: 1993-05-23
|
|
*
|
|
* This is an original work by Andy M Leighton and is placed in the
|
|
* public domain.
|
|
*/
|
|
|
|
#include "hbapi.h"
|
|
|
|
HB_FUNC( GT_STRCOUNT )
|
|
{
|
|
if( HB_ISCHAR( 1 ) && HB_ISCHAR( 2 ) )
|
|
{
|
|
const char * s1 = hb_parc( 1 );
|
|
const char * s2 = hb_parc( 2 );
|
|
HB_ISIZ l1 = hb_parclen( 1 );
|
|
HB_ISIZ l2 = hb_parclen( 2 );
|
|
HB_ISIZ count, p1, p2;
|
|
|
|
/* loop through s2 matching passed character (s1) with
|
|
each character of s1 */
|
|
|
|
for( count = 0, p2 = 0; p2 <= ( l2 - l1 ); p2++ )
|
|
{
|
|
int match = 1;
|
|
|
|
for( p1 = 0; p1 < l1; p1++ )
|
|
{
|
|
if( s1[ p1 ] != s2[ p2 + p1 ] )
|
|
match = 0;
|
|
}
|
|
|
|
if( match )
|
|
count++;
|
|
}
|
|
|
|
hb_retns( count );
|
|
}
|
|
else
|
|
hb_retns( -1 );
|
|
}
|