Line 15 is checking that
old_p->prior_to
is not null
If you replace the words succ_of with 'next' and replace prior_to with 'prev', it might help you understand the code.
So insert(PlayStation 1)
prev = null
next = null
insert(PlayStation 2)
PlayStation 2->next = PlayStation 1 //PlayStation 1->next = null
PlayStation 1->prev is null so line 15 does not execute
PlayStation 1->prev = PlayStation 2 //PlayStation 2 ->next->prev = Playstation 2
return PlayStation 2 //PlayStation 2->prev = null Since it is the top node now
insert(PlayStation 3)
PlayStation 3->next = PlayStation 2//PlayStation 2->next = PlayStation 1
PlayStation 2->prev is null so line 15 does not execute
PlayStation 2->prev = PlayStation 3 //PlayStation 3->next->prev = PlayStation 3
return PlayStation 3 //PlayStation 3->prev = null Since it is the top node now
So as you can see the insert function inserts any new element at the top of the list, so as you call the next list, you will finally get to the first element that was inserted.
You can also get rid of line 15 seeing as it will never evaluate to true
EDIT:
Also your if statement will not print what it is supposed to print because both values are never true at the same time because you cannot know the previous link only the next link. So
new_p->prior_to
will only be true at the end of the next insert operation
Implementation in Java that inserts at the end of the list. Some attributes are inherited:
LinkedList:
http://ideone.com/NgGo4Q
DoublyLinkedList:
http://ideone.com/e8r8De