mirror of
https://git.libssh.org/projects/libssh.git
synced 2026-02-09 09:54:25 +09:00
misc: Reformat
Signed-off-by: Jakub Jelen <jjelen@redhat.com> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
This commit is contained in:
committed by
Andreas Schneider
parent
96595d1674
commit
f6709b03e6
72
src/misc.c
72
src/misc.c
@@ -430,22 +430,22 @@ int ssh_is_ipaddr(const char *str)
|
|||||||
|
|
||||||
char *ssh_lowercase(const char* str)
|
char *ssh_lowercase(const char* str)
|
||||||
{
|
{
|
||||||
char *new, *p;
|
char *new, *p;
|
||||||
|
|
||||||
if (str == NULL) {
|
if (str == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
new = strdup(str);
|
new = strdup(str);
|
||||||
if (new == NULL) {
|
if (new == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (p = new; *p; p++) {
|
for (p = new; *p; p++) {
|
||||||
*p = tolower(*p);
|
*p = tolower(*p);
|
||||||
}
|
}
|
||||||
|
|
||||||
return new;
|
return new;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *ssh_hostport(const char *host, int port)
|
char *ssh_hostport(const char *host, int port)
|
||||||
@@ -865,32 +865,32 @@ int ssh_list_prepend(struct ssh_list *list, const void *data)
|
|||||||
|
|
||||||
void ssh_list_remove(struct ssh_list *list, struct ssh_iterator *iterator)
|
void ssh_list_remove(struct ssh_list *list, struct ssh_iterator *iterator)
|
||||||
{
|
{
|
||||||
struct ssh_iterator *ptr, *prev;
|
struct ssh_iterator *ptr, *prev;
|
||||||
|
|
||||||
if (list == NULL) {
|
if (list == NULL) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
prev=NULL;
|
prev = NULL;
|
||||||
ptr=list->root;
|
ptr = list->root;
|
||||||
while(ptr && ptr != iterator){
|
while (ptr && ptr != iterator) {
|
||||||
prev=ptr;
|
prev = ptr;
|
||||||
ptr=ptr->next;
|
ptr = ptr->next;
|
||||||
}
|
}
|
||||||
if(!ptr){
|
if (!ptr) {
|
||||||
/* we did not find the element */
|
/* we did not find the element */
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
/* unlink it */
|
/* unlink it */
|
||||||
if(prev)
|
if (prev)
|
||||||
prev->next=ptr->next;
|
prev->next = ptr->next;
|
||||||
/* if iterator was the head */
|
/* if iterator was the head */
|
||||||
if(list->root == iterator)
|
if (list->root == iterator)
|
||||||
list->root=iterator->next;
|
list->root = iterator->next;
|
||||||
/* if iterator was the tail */
|
/* if iterator was the tail */
|
||||||
if(list->end == iterator)
|
if (list->end == iterator)
|
||||||
list->end = prev;
|
list->end = prev;
|
||||||
SAFE_FREE(iterator);
|
SAFE_FREE(iterator);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user