diff options
author | Karel Klic <kklic@redhat.com> | 2010-04-29 15:13:11 +0200 |
---|---|---|
committer | Karel Klic <kklic@redhat.com> | 2010-04-29 15:13:11 +0200 |
commit | e465938fa36e51eff4bd62b736bcc8d66f4d0785 (patch) | |
tree | ac6dca80c074db1463bab7664304ffbf33b72443 /lib/Utils | |
parent | 1d4051836f620499d7c3f1e8e2caf4c022e74b81 (diff) | |
download | abrt-e465938fa36e51eff4bd62b736bcc8d66f4d0785.tar.gz abrt-e465938fa36e51eff4bd62b736bcc8d66f4d0785.tar.xz abrt-e465938fa36e51eff4bd62b736bcc8d66f4d0785.zip |
Marked most functions as extern C; added extern keyword to function declarations
Diffstat (limited to 'lib/Utils')
-rw-r--r-- | lib/Utils/xfuncs.h | 92 |
1 files changed, 40 insertions, 52 deletions
diff --git a/lib/Utils/xfuncs.h b/lib/Utils/xfuncs.h index 327d9c9a..aa672af2 100644 --- a/lib/Utils/xfuncs.h +++ b/lib/Utils/xfuncs.h @@ -24,65 +24,45 @@ #include <dirent.h> #include <stdbool.h> -int ndelay_on(int fd); -int ndelay_off(int fd); -int close_on_exec_on(int fd); - #ifdef __cplusplus extern "C" { #endif -void* xmalloc(size_t size); -void* xrealloc(void *ptr, size_t size); -void* xzalloc(size_t size); -char* xstrdup(const char *s); -char* xstrndup(const char *s, int n); +extern int ndelay_on(int fd); +extern int ndelay_off(int fd); +extern int close_on_exec_on(int fd); -#ifdef __cplusplus -} -#endif +extern void* xmalloc(size_t size); +extern void* xrealloc(void *ptr, size_t size); +extern void* xzalloc(size_t size); +extern char* xstrdup(const char *s); +extern char* xstrndup(const char *s, int n); -void xpipe(int filedes[2]); -void xdup(int from); -void xdup2(int from, int to); -void xmove_fd(int from, int to); +extern void xpipe(int filedes[2]); +extern void xdup(int from); +extern void xdup2(int from, int to); +extern void xmove_fd(int from, int to); extern void xwrite(int fd, const void *buf, size_t count); extern void xwrite_str(int fd, const char *str); -off_t xlseek(int fd, off_t offset, int whence); +extern off_t xlseek(int fd, off_t offset, int whence); -void xchdir(const char *path); - -#ifdef __cplusplus -extern "C" { -#endif - -char* xvasprintf(const char *format, va_list p); -char* xasprintf(const char *format, ...); - -#ifdef __cplusplus -} -#endif - -#ifdef __cplusplus -std::string ssprintf(const char *format, ...); -#endif +extern void xchdir(const char *path); -void xsetenv(const char *key, const char *value); -int xsocket(int domain, int type, int protocol); -void xbind(int sockfd, struct sockaddr *my_addr, socklen_t addrlen); -void xlisten(int s, int backlog); -ssize_t xsendto(int s, const void *buf, size_t len, const struct sockaddr *to, socklen_t tolen); -void xstat(const char *name, struct stat *stat_buf); +extern char* xvasprintf(const char *format, va_list p); +extern char* xasprintf(const char *format, ...); -#ifdef __cplusplus -std::string get_home_dir(uid_t uid); -#endif +extern void xsetenv(const char *key, const char *value); +extern int xsocket(int domain, int type, int protocol); +extern void xbind(int sockfd, struct sockaddr *my_addr, socklen_t addrlen); +extern void xlisten(int s, int backlog); +extern ssize_t xsendto(int s, const void *buf, size_t len, const struct sockaddr *to, socklen_t tolen); +extern void xstat(const char *name, struct stat *stat_buf); -int xopen3(const char *pathname, int flags, int mode); -int xopen(const char *pathname, int flags); -void xunlink(const char *pathname); +extern int xopen3(const char *pathname, int flags, int mode); +extern int xopen(const char *pathname, int flags); +extern void xunlink(const char *pathname); /* Just testing dent->d_type == DT_REG is wrong: some filesystems * do not report the type, they report DT_UNKNOWN for every dirent @@ -90,15 +70,23 @@ void xunlink(const char *pathname); * This function handles this case. Note: it returns 0 on symlinks * even if they point to regular files. */ -int is_regular_file(struct dirent *dent, const char *dirname); -bool dot_or_dotdot(const char *filename); -char *last_char_is(const char *s, int c); +extern int is_regular_file(struct dirent *dent, const char *dirname); +extern bool dot_or_dotdot(const char *filename); +extern char *last_char_is(const char *s, int c); + +extern bool string_to_bool(const char *s); + +extern void xsetreuid(uid_t ruid, uid_t euid); +extern void xsetregid(gid_t rgid, gid_t egid); + #ifdef __cplusplus -std::string concat_path_file(const char *path, const char *filename); +} #endif -bool string_to_bool(const char *s); -void xsetreuid(uid_t ruid, uid_t euid); -void xsetregid(gid_t rgid, gid_t egid); +#ifdef __cplusplus +std::string ssprintf(const char *format, ...); +std::string concat_path_file(const char *path, const char *filename); +std::string get_home_dir(uid_t uid); +#endif #endif |