-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodify_sequence.c
More file actions
80 lines (65 loc) · 2.74 KB
/
modify_sequence.c
File metadata and controls
80 lines (65 loc) · 2.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
/*
*********************************************************************************************************
* INCLUDE FILES
*********************************************************************************************************
*/
#include "modify_sequence.h"
/*
*********************************************************************************************************
* LOCAL DEFINES
*********************************************************************************************************
*/
/*
*********************************************************************************************************
* LOCAL CONSTANTS
*********************************************************************************************************
*/
/*
*********************************************************************************************************
* LOCAL DATA TYPES
*********************************************************************************************************
*/
/*
*********************************************************************************************************
* LOCAL TABLES
*********************************************************************************************************
*/
/*
*********************************************************************************************************
* LOCAL GLOBAL VARIABLES
*********************************************************************************************************
*/
/*
*********************************************************************************************************
* LOCAL FUNCTION PROTOTYPES
*********************************************************************************************************
*/
/*
*********************************************************************************************************
* FUNCTIONS
*********************************************************************************************************
*/
/**
* @brief This function will swap the left-hand-side with the right-hand-side.
*
* @param lhs the pointer to the left-hand-side item
* @param rhs the pointer to the right-hand-side item
*
* @return the error code
*/
extern inline errno_t
modify_sequence_control_swap(void *lhs, void *rhs,size_t len)
{
assert(lhs);
assert(rhs);
assert(len);
static void *tmp;
if (NULL == (tmp = calloc(len, sizeof(char)))) {
return -1;
}
memcpy(tmp, lhs, len);
memcpy(lhs, rhs, len);
memcpy(rhs, tmp, len);
free(tmp);
return 0;
}