Skip to content

Commit ebbb858

Browse files
committed
Update ltfs_arch_ops.h
1 parent 2ef6dec commit ebbb858

1 file changed

Lines changed: 13 additions & 57 deletions

File tree

src/libltfs/arch/ltfs_arch_ops.h

Lines changed: 13 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -122,75 +122,31 @@ extern "C" {
122122

123123
#define arch_getenv( buffer, varname) do { size_t len; _dupenv_s(&(buffer), &(len), varname); } while (0)
124124

125+
#define arch_strcpy(dest, bufferCount, src) strcpy_s((dest), (bufferCount), (src))
125126

126-
inline void arch_strcpy(char* dest, size_t bufferCount, const char* src)
127-
{
128-
strcpy_s(dest, bufferCount, src);
129-
}
127+
#define arch_strncpy(dest, src, sizeInBytes, maxCount) strncpy_s((dest), (sizeInBytes), (src), (maxCount))
130128

129+
#define arch_strcat(dest, sizeInBytes, src) strcat_s((dest), (sizeInBytes), (src))
131130

132-
inline void arch_strncpy(char* dest, const char* src, size_t sizeInBytes, size_t maxCount)
133-
{
134-
strncpy_s(dest, sizeInBytes, src, maxCount);
135-
}
131+
#define arch_strtok(string, delimiter, context) strtok_s((string), (delimiter), &(context))
136132

133+
#define arch_unlink(filename) _unlink((filename))
137134

138-
inline void arch_strcat(char* dest, size_t sizeInBytes, const char* src)
139-
{
140-
strcat_s(dest, sizeInBytes, src);
141-
}
135+
#define arch_write(fileHandle, buf, maxCharCount) _write((fileHandle), (buf), (maxCharCount))
142136

137+
#define arch_close(fileHandle) _close((fileHandle))
143138

144-
inline char* arch_strtok(char* string, const char* delimiter, char** context)
145-
{
146-
return strtok_s(string, delimiter, context);
147-
}
139+
#define arch_read(fileHandle, dstBuf, maxCharCount) _read((fileHandle), (dstBuf), (maxCharCount))
148140

149-
inline int arch_unlink(const char* filename)
150-
{
151-
return _unlink(filename);
152-
}
141+
#define arch_strdup(source) _strdup((source))
153142

154-
inline int arch_write(int fileHandle, const void* buf, unsigned int maxCharCount)
155-
{
156-
return _write(fileHandle, buf, maxCharCount);
157-
}
143+
#define arch_chmod(filename, mode) _chmod((filename), (mode))
158144

159-
inline int arch_close(int fileHandle)
160-
{
161-
return _close(fileHandle);
162-
}
145+
#define arch_getpid() _getpid()
163146

164-
inline int arch_read(int fileHandle, void* dstBuf, unsigned int maxCharCount)
165-
{
166-
return _read(fileHandle, dstBuf, maxCharCount);
167-
}
147+
#define arch_access(filename, mode) _access((filename), (mode))
168148

169-
inline char* arch_strdup(const char* source)
170-
{
171-
return _strdup(source);
172-
}
173-
174-
inline int arch_chmod(const char* filename, int mode)
175-
{
176-
return _chmod(filename, mode);
177-
}
178-
179-
inline int arch_getpid(void)
180-
{
181-
return _getpid();
182-
}
183-
184-
inline int arch_access(const char* filename, int mode)
185-
{
186-
return _access(filename, mode);
187-
}
188-
189-
190-
inline void arch_xmlfree(void* ptr)
191-
{
192-
xmlFree(ptr);
193-
}
149+
#define arch_xmlfree(ptr) xmlFree((ptr))
194150

195151

196152
#else

0 commit comments

Comments
 (0)