Rename uv_get_hrtime, uv_get_exepath to uv_hrtime, uv_exepath

This commit is contained in:
Ryan Dahl 2011-06-28 14:26:18 +02:00
parent ac005f0a04
commit 7b56134f73
8 changed files with 17 additions and 17 deletions

View File

@ -33,20 +33,20 @@ TEST_IMPL(get_currentexe) {
int r;
size = sizeof(buffer) / sizeof(buffer[0]);
r = uv_get_exepath(buffer, &size);
r = uv_exepath(buffer, &size);
ASSERT(!r);
match = strstr(buffer, executable_path);
/* Verify that the path returned from uv_get_exepath is a subdirectory of executable_path */
/* Verify that the path returned from uv_exepath is a subdirectory of executable_path */
ASSERT(match && !strcmp(match, executable_path));
ASSERT(size == strlen(buffer));
/* Negative tests */
size = sizeof(buffer) / sizeof(buffer[0]);
r = uv_get_exepath(NULL, &size);
r = uv_exepath(NULL, &size);
ASSERT(r == -1);
r = uv_get_exepath(buffer, NULL);
r = uv_exepath(buffer, NULL);
ASSERT(r == -1);
return 0;

View File

@ -30,9 +30,9 @@
TEST_IMPL(hrtime) {
uint64_t a, b, diff;
a = uv_get_hrtime();
a = uv_hrtime();
uv_sleep(1);
b = uv_get_hrtime();
b = uv_hrtime();
diff = b - a;

View File

@ -26,7 +26,7 @@
#include <mach/mach_time.h>
uint64_t uv_get_hrtime() {
uint64_t uv_hrtime() {
uint64_t time;
Nanoseconds enano;
time = mach_absolute_time();
@ -35,7 +35,7 @@ uint64_t uv_get_hrtime() {
}
int uv_get_exepath(char* buffer, size_t* size) {
int uv_exepath(char* buffer, size_t* size) {
uint32_t usize;
int result;
char* path;

View File

@ -21,7 +21,7 @@
#include "uv.h"
int uv_get_exepath(char* buffer, size_t* size) {
int uv_exepath(char* buffer, size_t* size) {
uint32_t usize;
int result;
char* path;

View File

@ -28,14 +28,14 @@
* There's probably some way to get time from Linux than gettimeofday(). What
* it is, I don't know.
*/
uint64_t uv_get_hrtime() {
uint64_t uv_hrtime() {
struct timespec ts;
clock_gettime(CLOCK_MONOTONIC, &ts);
return (ts.tv_sec * NANOSEC + ts.tv_nsec);
}
int uv_get_exepath(char* buffer, size_t* size) {
int uv_exepath(char* buffer, size_t* size) {
uint32_t usize;
int result;
char* path;

View File

@ -27,7 +27,7 @@
#include <sys/time.h>
uint64_t uv_get_hrtime() {
uint64_t uv_hrtime() {
return (gethrtime());
}
@ -37,7 +37,7 @@ uint64_t uv_get_hrtime() {
* of the function, but this function could be called by multiple consumers and
* we don't want to potentially create a race condition in the use of snprintf.
*/
int uv_get_exepath(char* buffer, size_t* size) {
int uv_exepath(char* buffer, size_t* size) {
size_t res;
pid_t pid;
char buf[PATH_MAX];

View File

@ -1746,7 +1746,7 @@ int uv_utf8_to_utf16(const char* utf8Buffer, wchar_t* utf16Buffer, size_t utf16S
}
int uv_get_exepath(char* buffer, size_t* size) {
int uv_exepath(char* buffer, size_t* size) {
int retVal;
size_t utf16Size;
wchar_t* utf16Buffer;
@ -1791,7 +1791,7 @@ done:
}
uint64_t uv_get_hrtime(void) {
uint64_t uv_hrtime(void) {
assert(0 && "implement me");
}

4
uv.h
View File

@ -457,7 +457,7 @@ struct sockaddr_in uv_ip4_addr(const char* ip, int port);
struct sockaddr_in6 uv_ip6_addr(const char* ip, int port);
/* Gets the executable path */
int uv_get_exepath(char* buffer, size_t* size);
int uv_exepath(char* buffer, size_t* size);
/* the presence of this union forces similar struct layout */
union uv_any_handle {
@ -513,7 +513,7 @@ uv_counters_t* uv_counters();
* Note not every platform can support nanosecond resolution; however, this
* value will always be in nanoseconds.
*/
extern uint64_t uv_get_hrtime(void);
extern uint64_t uv_hrtime(void);
#ifdef __cplusplus
}