Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
aml
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
27
Issues
27
List
Boards
Labels
Milestones
Merge Requests
6
Merge Requests
6
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
argo
aml
Commits
d07894c9
Commit
d07894c9
authored
Mar 29, 2018
by
Kamil Iskra
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[refactor] constify vector and scratch
Also add documentation to two forgotten functions in the header file.
parent
62df1333
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
21 additions
and
11 deletions
+21
-11
src/aml.h
src/aml.h
+14
-4
src/scratch.c
src/scratch.c
+1
-1
src/scratch_par.c
src/scratch_par.c
+2
-2
src/scratch_seq.c
src/scratch_seq.c
+2
-2
src/vector.c
src/vector.c
+2
-2
No files found.
src/aml.h
View file @
d07894c9
...
...
@@ -56,7 +56,7 @@ struct aml_vector {
* "vector": an initialized vector structure.
* Returns the number of elements in the vector.
*/
size_t
aml_vector_size
(
struct
aml_vector
*
vector
);
size_t
aml_vector_size
(
const
struct
aml_vector
*
vector
);
/*
* Provides a pointer of element with index "index" within the vector.
* "vector": an initialized vector structure.
...
...
@@ -71,7 +71,7 @@ void *aml_vector_get(struct aml_vector *vector, int index);
* "key": the key to look for.
* Returns the index of the found element or "na" if not found.
*/
int
aml_vector_find
(
struct
aml_vector
*
vector
,
int
key
);
int
aml_vector_find
(
const
struct
aml_vector
*
vector
,
int
key
);
/*
* Resizes the vector. The keys of the newly allocated elements are set to the
* "na" value.
...
...
@@ -1394,7 +1394,7 @@ struct aml_scratch_ops {
struct
aml_scratch_request
*
req
);
int
(
*
wait_request
)(
struct
aml_scratch_data
*
scratch
,
struct
aml_scratch_request
*
req
);
void
*
(
*
baseptr
)(
struct
aml_scratch_data
*
scratch
);
void
*
(
*
baseptr
)(
const
struct
aml_scratch_data
*
scratch
);
};
struct
aml_scratch
{
...
...
@@ -1474,7 +1474,7 @@ int aml_scratch_cancel(struct aml_scratch *scratch,
* "scratch": an initialized scratch structure.
* Returns a base pointer to the scratchpad memory buffer.
*/
void
*
aml_scratch_baseptr
(
struct
aml_scratch
*
scratch
);
void
*
aml_scratch_baseptr
(
const
struct
aml_scratch
*
scratch
);
/*******************************************************************************
* Sequential scratchpad API:
...
...
@@ -1662,7 +1662,17 @@ int aml_scratch_par_destroy(struct aml_scratch *scratch);
* Initialize internal structures, cleanup everything at the end.
******************************************************************************/
/*
* Initializes the library.
* "argc": pointer to the main()'s argc argument; contents can get modified.
* "argv": pointer to the main()'s argv argument; contents can get modified.
* Returns 0 if successful; an error code otherwise.
*/
int
aml_init
(
int
*
argc
,
char
**
argv
[]);
/*
* Terminates the library.
* Returns 0 if successful; an error code otherwise.
*/
int
aml_finalize
(
void
);
#endif
src/scratch.c
View file @
d07894c9
...
...
@@ -80,7 +80,7 @@ int aml_scratch_wait(struct aml_scratch *scratch, struct aml_scratch_request *re
return
scratch
->
ops
->
wait_request
(
scratch
->
data
,
req
);
}
void
*
aml_scratch_baseptr
(
struct
aml_scratch
*
scratch
)
void
*
aml_scratch_baseptr
(
const
struct
aml_scratch
*
scratch
)
{
assert
(
scratch
!=
NULL
);
return
scratch
->
ops
->
baseptr
(
scratch
->
data
);
...
...
src/scratch_par.c
View file @
d07894c9
...
...
@@ -184,10 +184,10 @@ int aml_scratch_par_wait_request(struct aml_scratch_data *d,
return
0
;
}
void
*
aml_scratch_par_baseptr
(
struct
aml_scratch_data
*
d
)
void
*
aml_scratch_par_baseptr
(
const
struct
aml_scratch_data
*
d
)
{
assert
(
d
!=
NULL
);
struct
aml_scratch_par
*
scratch
=
(
struct
aml_scratch_par
*
)
d
;
const
struct
aml_scratch_par
*
scratch
=
(
const
struct
aml_scratch_par
*
)
d
;
return
scratch
->
data
.
sch_ptr
;
}
...
...
src/scratch_seq.c
View file @
d07894c9
...
...
@@ -186,10 +186,10 @@ int aml_scratch_seq_wait_request(struct aml_scratch_data *d,
return
0
;
}
void
*
aml_scratch_seq_baseptr
(
struct
aml_scratch_data
*
d
)
void
*
aml_scratch_seq_baseptr
(
const
struct
aml_scratch_data
*
d
)
{
assert
(
d
!=
NULL
);
struct
aml_scratch_seq
*
scratch
=
(
struct
aml_scratch_seq
*
)
d
;
const
struct
aml_scratch_seq
*
scratch
=
(
const
struct
aml_scratch_seq
*
)
d
;
return
scratch
->
data
.
sch_ptr
;
}
...
...
src/vector.c
View file @
d07894c9
...
...
@@ -28,7 +28,7 @@ int aml_vector_resize(struct aml_vector *vec, size_t newsize)
return
0
;
}
size_t
aml_vector_size
(
struct
aml_vector
*
vec
)
size_t
aml_vector_size
(
const
struct
aml_vector
*
vec
)
{
assert
(
vec
!=
NULL
);
return
vec
->
nbelems
;
...
...
@@ -45,7 +45,7 @@ void *aml_vector_get(struct aml_vector *vec, int id)
}
/* return index of first element with key */
int
aml_vector_find
(
struct
aml_vector
*
vec
,
int
key
)
int
aml_vector_find
(
const
struct
aml_vector
*
vec
,
int
key
)
{
assert
(
vec
!=
NULL
);
for
(
int
i
=
0
;
i
<
vec
->
nbelems
;
i
++
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment