Compare commits
2 Commits
c73be4c21c
...
16470f2592
Author | SHA1 | Date | |
---|---|---|---|
16470f2592
|
|||
db42c21754
|
10
ds.c
10
ds.c
@ -67,7 +67,7 @@ void
|
||||
return NULL;
|
||||
}
|
||||
|
||||
for (i = -1, cur = *ll;; i++, cur = cur->next) {
|
||||
for (i = -1, cur = *ll; cur; i++, cur = cur->next) {
|
||||
if (i + 1 == idx) {
|
||||
if (idx == 0) {
|
||||
rm = cur;
|
||||
@ -86,6 +86,10 @@ void
|
||||
}
|
||||
}
|
||||
|
||||
if (!rm) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
data = rm->data;
|
||||
free(rm);
|
||||
return data;
|
||||
@ -127,6 +131,10 @@ void
|
||||
}
|
||||
}
|
||||
|
||||
if (!rm) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
data = rm->data;
|
||||
free(rm);
|
||||
return data;
|
||||
|
14
ds.h
14
ds.h
@ -1,14 +1,14 @@
|
||||
#ifndef _DS_LOADED
|
||||
#define _DS_LOADED
|
||||
#ifndef DS_H
|
||||
#define DS_H
|
||||
|
||||
typedef struct _sll {
|
||||
struct _sll *next;
|
||||
typedef struct _ds_sll {
|
||||
struct _ds_sll *next;
|
||||
void *data;
|
||||
} ds_sll_t;
|
||||
|
||||
typedef struct _dll {
|
||||
struct _dll *next;
|
||||
struct _dll *prev;
|
||||
typedef struct _ds_dll {
|
||||
struct _ds_dll *next;
|
||||
struct _ds_dll *prev;
|
||||
void *data;
|
||||
} ds_dll_t;
|
||||
|
||||
|
Reference in New Issue
Block a user