Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
e3-require
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ESS EPICS Environment
wrappers
e3-require
Commits
91f07f8a
Commit
91f07f8a
authored
1 year ago
by
Lucas Magalhães
Browse files
Options
Downloads
Patches
Plain Diff
Add macro for "LibRelease" literal
Let's avoid use magic numbers
parent
02d9ff1b
No related branches found
No related tags found
1 merge request
!139
E3-1214: Fix usage of string functions
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
require-ess/src/require.c
+3
-2
3 additions, 2 deletions
require-ess/src/require.c
with
3 additions
and
2 deletions
require-ess/src/require.c
+
3
−
2
View file @
91f07f8a
...
...
@@ -93,6 +93,7 @@ int requireDebug;
#define LIBDIR "lib" OSI_PATH_SEPARATOR
#define TEMPLATEDIR "db"
#define LIBRELEASE "LibRelease"
#ifndef OS_CLASS
#error OS_CLASS not defined: Try to compile with USR_CFLAGS += -DOS_CLASS='"${OS_CLASS}"'
...
...
@@ -460,7 +461,7 @@ static int findLibRelease(struct dl_phdr_info *info, /* shared library info */
char
*
version
=
NULL
;
char
*
symname
=
NULL
;
/* get space for library path + "LibRelease" */
char
name
[
PATH_MAX
+
11
]
=
{
0
};
char
name
[
PATH_MAX
+
(
sizeof
(
LIBRELEASE
)
/
sizeof
(
char
))
]
=
{
0
};
(
void
)
data
;
/* unused */
if
(
size
<
sizeof
(
struct
dl_phdr_info
))
...
...
@@ -487,7 +488,7 @@ static int findLibRelease(struct dl_phdr_info *info, /* shared library info */
*
(
symname
=
p
+
2
)
=
'_'
;
/* replace "lib" with "_" */
p
=
strchr
(
symname
,
'.'
);
/* find ".so" extension */
if
(
p
==
NULL
)
p
=
symname
+
strnlen
(
symname
,
PATH_MAX
);
/* no file extension ? */
strcpy
(
p
,
"LibRelease"
);
/* append "LibRelease" to module name */
strcpy
(
p
,
LIBRELEASE
);
/* append "LibRelease" to module name */
version
=
dlsym
(
handle
,
symname
);
/* find symbol "_<module>LibRelease" */
if
(
version
)
{
*
p
=
0
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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