Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -> allocate list
- malloc( 24) => 0x100100080 [slist.c:7 in slist_alloc()]
- list @0x100100080, head 0x0, tail 0x0, size 0
- -> push (add to top)
- malloc( 16) => 0x1001000a0 [slist.c:48 in slist_node_alloc()]
- list @0x100100080, head 0x1001000a0, tail 0x1001000a0, size 1
- node @0x1001000a0, data 0xdecafbad2, next 0x0, pos 0
- -> append (add to back)
- malloc( 16) => 0x1001000b0 [slist.c:48 in slist_node_alloc()]
- list @0x100100080, head 0x1001000a0, tail 0x1001000b0, size 2
- node @0x1001000a0, data 0xdecafbad2, next 0x1001000b0, pos 0
- node @0x1001000b0, data 0xbaadf00d4, next 0x0, pos 1
- -> insert (at position 0)
- malloc( 16) => 0x1001000c0 [slist.c:48 in slist_node_alloc()]
- list @0x100100080, head 0x1001000c0, tail 0x1001000b0, size 3
- node @0x1001000c0, data 0xcafebabe1, next 0x1001000a0, pos 0
- node @0x1001000a0, data 0xdecafbad2, next 0x1001000b0, pos 1
- node @0x1001000b0, data 0xbaadf00d4, next 0x0, pos 2
- -> insert (at position 2)
- malloc( 16) => 0x1001000d0 [slist.c:48 in slist_node_alloc()]
- list @0x100100080, head 0x1001000c0, tail 0x1001000b0, size 4
- node @0x1001000c0, data 0xcafebabe1, next 0x1001000a0, pos 0
- node @0x1001000a0, data 0xdecafbad2, next 0x1001000d0, pos 1
- node @0x1001000d0, data 0xdeadbeef3, next 0x1001000b0, pos 2
- node @0x1001000b0, data 0xbaadf00d4, next 0x0, pos 3
- -> check size (should be 4)
- -> test if first node it correct
- -> test if last node is correct
- -> copy list
- malloc( 24) => 0x1001000e0 [slist.c:7 in slist_alloc()]
- malloc( 16) => 0x100100100 [slist.c:61 in slist_node_copy()]
- malloc( 16) => 0x100100110 [slist.c:61 in slist_node_copy()]
- malloc( 16) => 0x100100120 [slist.c:61 in slist_node_copy()]
- malloc( 16) => 0x100100130 [slist.c:61 in slist_node_copy()]
- list @0x1001000e0, head 0x100100100, tail 0x100100130, size 4
- node @0x100100100, data 0xcafebabe1, next 0x100100110, pos 0
- node @0x100100110, data 0xdecafbad2, next 0x100100120, pos 1
- node @0x100100120, data 0xdeadbeef3, next 0x100100130, pos 2
- node @0x100100130, data 0xbaadf00d4, next 0x0, pos 3
- -> free lists
- free(0x1001000c0) [slist.c:36 in slist_free()]
- free(0x1001000a0) [slist.c:36 in slist_free()]
- free(0x1001000d0) [slist.c:36 in slist_free()]
- free(0x1001000b0) [slist.c:36 in slist_free()]
- free(0x100100080) [slist.c:42 in slist_free()]
- free(0x100100100) [slist.c:36 in slist_free()]
- free(0x100100110) [slist.c:36 in slist_free()]
- free(0x100100120) [slist.c:36 in slist_free()]
- free(0x100100130) [slist.c:36 in slist_free()]
- free(0x1001000e0) [slist.c:42 in slist_free()]
- -> copy empty list
- malloc( 24) => 0x1001000e0 [slist.c:7 in slist_alloc()]
- malloc( 24) => 0x100100100 [slist.c:7 in slist_alloc()]
- list @0x100100100, head 0x0, tail 0x0, size 0
- -> insert some data
- malloc( 16) => 0x100100120 [slist.c:48 in slist_node_alloc()]
- list @0x100100100, head 0x100100120, tail 0x100100120, size 1
- node @0x100100120, data 0xc0debabe5, next 0x0, pos 0
- -> remove nonexistant node
- list @0x100100100, head 0x100100120, tail 0x100100120, size 1
- node @0x100100120, data 0xc0debabe5, next 0x0, pos 0
- -> inserting another node
- malloc( 16) => 0x100100130 [slist.c:48 in slist_node_alloc()]
- list @0x100100100, head 0x100100130, tail 0x100100120, size 2
- node @0x100100130, data 0xcafebabe1, next 0x100100120, pos 0
- node @0x100100120, data 0xc0debabe5, next 0x0, pos 1
- -> remove existing node
- free(0x100100130) [slist.c:268 in slist_pop()]
- list @0x100100100, head 0x100100120, tail 0x100100120, size 1
- node @0x100100120, data 0xc0debabe5, next 0x0, pos 0
- -> popping nonexistant node
- -> popping existant node
- free(0x100100120) [slist.c:268 in slist_pop()]
- list @0x100100100, head 0x0, tail 0x0, size 0
- -> filling list with data
- malloc( 16) => 0x100100120 [slist.c:48 in slist_node_alloc()]
- malloc( 16) => 0x100100130 [slist.c:48 in slist_node_alloc()]
- malloc( 16) => 0x100100080 [slist.c:48 in slist_node_alloc()]
- malloc( 16) => 0x100100090 [slist.c:48 in slist_node_alloc()]
- malloc( 16) => 0x1001000a0 [slist.c:48 in slist_node_alloc()]
- malloc( 16) => 0x1001000b0 [slist.c:48 in slist_node_alloc()]
- list @0x1001000e0, head 0x100100120, tail 0x1001000b0, size 6
- node @0x100100120, data 0xcafebabe1, next 0x100100130, pos 0
- node @0x100100130, data 0xdecafbad2, next 0x100100080, pos 1
- node @0x100100080, data 0xdeadbeef3, next 0x100100090, pos 2
- node @0x100100090, data 0xbaadf00d4, next 0x1001000a0, pos 3
- node @0x1001000a0, data 0xc0debabe5, next 0x1001000b0, pos 4
- node @0x1001000b0, data 0xbadcab1e6, next 0x0, pos 5
- -> checking data
- -> setting nonexistant nodes
- list @0x1001000e0, head 0x100100120, tail 0x1001000b0, size 6
- node @0x100100120, data 0xcafebabe1, next 0x100100130, pos 0
- node @0x100100130, data 0xdecafbad2, next 0x100100080, pos 1
- node @0x100100080, data 0xdeadbeef3, next 0x100100090, pos 2
- node @0x100100090, data 0xbaadf00d4, next 0x1001000a0, pos 3
- node @0x1001000a0, data 0xc0debabe5, next 0x1001000b0, pos 4
- node @0x1001000b0, data 0xbadcab1e6, next 0x0, pos 5
- -> setting valid nodes
- list @0x1001000e0, head 0x100100120, tail 0x1001000b0, size 6
- node @0x100100120, data 0xbadcab1e6, next 0x100100130, pos 0
- node @0x100100130, data 0xc0debabe5, next 0x100100080, pos 1
- node @0x100100080, data 0xbaadf00d4, next 0x100100090, pos 2
- node @0x100100090, data 0xbaadf00d4, next 0x1001000a0, pos 3
- node @0x1001000a0, data 0xc0debabe5, next 0x1001000b0, pos 4
- node @0x1001000b0, data 0xcafebabe1, next 0x0, pos 5
Add Comment
Please, Sign In to add comment