Revision 5f3adef4 rep/repoclient.c

View differences:

rep/repoclient.c
7 7
void deferred_publish_cb(evutil_socket_t fd, short what, void *arg);
8 8

  
9 9
void repInit(const char *config) {
10
#if !WIN32 && !MAC_OS
11 10
	if ((publish_streambuffer.stream = open_memstream(&publish_streambuffer.buffer, &publish_streambuffer.len)) 
12
		== NULL) {
13
#else
14
	publish_streambuffer.buffsize = PUBLISH_BUFFER_SIZE;
15
	publish_streambuffer.buffer = malloc(publish_streambuffer.buffsize);
16
        if(publish_streambuffer.buffer == NULL) {
17
		publish_streambuffer.buffsize = 0;
18
#endif
19
		fatal("Unable to initilize repoclient, file %s, line %d", __FILE__, __LINE__);
20
	}
21
	else debug("The Repository client library is ready");
11
		== NULL) fatal("Unable to initilize repoclient, file %s, line %d", __FILE__, __LINE__);
12
	debug("The Repository client library is ready");
22 13
}
23 14

  
24 15
/** Initialize the repoclient instance by parsing the server spec string and setting up things */
25
HANDLE repOpen(const char *server, int publish_delay) { 
26
	struct reposerver *rep;
27

  
28
        if(server == NULL || strlen(server) == 0 || strcmp(server, "-") == 0) {
29
                warn("Repository publishing is disabled");
30
		return NULL;
31
	}
32

  
33
	rep = malloc(sizeof(struct reposerver));
16
HANDLE repOpen(const char *server, int publish_delay) {
17
	struct reposerver *rep = malloc(sizeof(struct reposerver));
34 18
	if (!rep) fatal("Out of memory while initializing repository client for %s", server);
35 19
	rep->magic=REPOSERVER_MAGIC;
36 20
	rep->publish_buffer = NULL;
......
53 37
		event_base_once(eventbase, -1, EV_TIMEOUT, deferred_publish_cb, rep, &t);
54 38
	}
55 39

  
56
        debug("X.repOpen cclosing\n");
57
        return rep;
40
	return (HANDLE *)rep;
58 41
}
59 42

  
60 43
/** Close the repoclient instance and free resources */

Also available in: Unified diff