Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Z
zmap
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Iterations
Wiki
Requirements
Jira
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ensembl-gh-mirror
zmap
Commits
1bd0999f
Commit
1bd0999f
authored
16 years ago
by
edgrif
Browse files
Options
Downloads
Patches
Plain Diff
add a case insensitive version of strstr like g_ascii_XXX
parent
2fc62e77
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/include/ZMap/zmapGLibUtils.h
+4
-3
4 additions, 3 deletions
src/include/ZMap/zmapGLibUtils.h
src/zmapUtils/zmapGLibUtils.c
+44
-2
44 additions, 2 deletions
src/zmapUtils/zmapGLibUtils.c
with
48 additions
and
5 deletions
src/include/ZMap/zmapGLibUtils.h
+
4
−
3
View file @
1bd0999f
...
...
@@ -26,9 +26,9 @@
* glib but not included with their distribution.
*
* HISTORY:
* Last edited: A
pr 22 12:39
2008 (edgrif)
* Last edited: A
ug 5 16:42
2008 (edgrif)
* Created: Thu Oct 13 15:56:54 2005 (edgrif)
* CVS info: $Id: zmapGLibUtils.h,v 1.1
7
2008-0
4
-2
2 12:22:23
edgrif Exp $
* CVS info: $Id: zmapGLibUtils.h,v 1.1
8
2008-0
8
-2
9 09:54:16
edgrif Exp $
*-------------------------------------------------------------------
*/
#ifndef ZMAP_GLIBUTILS_H
...
...
@@ -64,7 +64,8 @@ typedef gboolean (*ZMapGFuncCond)(gpointer data, gpointer user_data) ;
char
*
zMap_g_remove_char
(
char
*
string
,
char
ch
)
;
gchar
*
zMap_g_remove_char
(
char
*
string
,
char
ch
)
;
gchar
*
zMap_g_ascii_strstrcasecmp
(
const
gchar
*
haystack
,
const
gchar
*
needle
)
;
void
zMap_g_list_foreach_reverse
(
GList
*
list
,
GFunc
func
,
gpointer
user_data
);
void
zMap_g_list_foreach_directional
(
GList
*
list
,
GFunc
func
,
gpointer
user_data
,
...
...
This diff is collapsed.
Click to expand it.
src/zmapUtils/zmapGLibUtils.c
+
44
−
2
View file @
1bd0999f
...
...
@@ -26,9 +26,9 @@
*
* Exported functions: See ZMap/zmapGLibUtils.h
* HISTORY:
* Last edited: A
pr 22 13:00
2008 (edgrif)
* Last edited: A
ug 5 16:52
2008 (edgrif)
* Created: Thu Oct 13 15:22:35 2005 (edgrif)
* CVS info: $Id: zmapGLibUtils.c,v 1.2
4
2008-0
4
-2
2 12:22:22
edgrif Exp $
* CVS info: $Id: zmapGLibUtils.c,v 1.2
5
2008-0
8
-2
9 09:54:16
edgrif Exp $
*-------------------------------------------------------------------
*/
...
...
@@ -136,6 +136,48 @@ char *zMap_g_remove_char(char *string, char ch)
}
/* This function is like strstr() but case independent. The code is modified
* from g_ascii_strcasecmp() from glib/gstrfuncs.c. This seems like a no-brainer
* to be added to glib. */
gchar
*
zMap_g_ascii_strstrcasecmp
(
const
gchar
*
haystack
,
const
gchar
*
needle
)
{
gchar
*
match_start
=
NULL
,
*
needle_start
=
(
gchar
*
)
needle
;
gint
c1
,
c2
;
#define ISUPPER(c) ((c) >= 'A' && (c) <= 'Z')
#define TOLOWER(c) (ISUPPER (c) ? (c) - 'A' + 'a' : (c))
g_return_val_if_fail
(
haystack
!=
NULL
,
NULL
);
g_return_val_if_fail
(
needle
!=
NULL
,
NULL
);
while
(
*
haystack
&&
*
needle
)
{
c1
=
(
gint
)(
guchar
)
TOLOWER
(
*
haystack
);
c2
=
(
gint
)(
guchar
)
TOLOWER
(
*
needle
);
if
(
c1
==
c2
)
{
if
(
!
match_start
)
match_start
=
(
gchar
*
)
haystack
;
haystack
++
;
needle
++
;
}
else
{
match_start
=
NULL
;
needle
=
needle_start
;
haystack
++
;
}
}
if
((
*
needle
))
match_start
=
NULL
;
return
match_start
;
}
/*
* Additions to GList
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment