forked from SZV10X_Software/SZV103_FM33A0xxEV_SiZhu

wujiazhi
2024-06-13 72def895431ad7a08e635b11f3da738e2b2c4618
Soft/linked_list.c
@@ -30,33 +30,21 @@
//Ë«ÖØÖ¸Õ룺ָÏòÖ¸ÕëµÄÖ¸Õ룬Èç¹ûÐè¸Ä±äÖ¸ÕëµØÖ·µÄÖµ£¬Ôò¿ÉÓÃË«ÖØÖ¸Õë
void Alarm_List_Node_PushBack(ALARM_NODE_T ** ppList,SYS_ALARM_VALVE_T alarm_id)
{
//   ALARM_NODE_T * tail, * now_ptr;
//
//   if(alarm_id != ALARM_ID_NORMAL)
//   {
//      alarm_list_cnt++;
//      if(*ppList == NULL)
//      {
//         *ppList = Alarm_List_Node_Add(alarm_id);
//      }
//      else
//      {
//         //ÅжÏÁ´±íÖÐÊÇ·ñÒѾ­´æÔڸñ¨¾¯id£¬ÒѾ­´æÔÚ²»ÔÙ²åÈëÁ´±í
//         do{
//            if(now_ptr->list_data == alarm_id){
//               return;
//            }else{
//               now_ptr = now_ptr->alarm_list_next;
//            }
//
//         }while(now_ptr != NULL);
//
//         tail = *ppList;
//         while(tail->alarm_list_next)
//            tail = tail->alarm_list_next;
//         tail->alarm_list_next = Alarm_List_Node_Add(alarm_id);
//      }
//   }
   if(alarm_id != AV_NORMAL)
   {
      alarm_list_cnt++;
      if(*ppList == NULL)
      {
         *ppList = Alarm_List_Node_Add(alarm_id);
      }
      else
      {
         ALARM_NODE_T * tail = *ppList;
         while(tail->alarm_list_next)
            tail = tail->alarm_list_next;
         tail->alarm_list_next = Alarm_List_Node_Add(alarm_id);
      }
   }
}
//µ¥Á´±íµÄβɾ
void Alarm_List_Node_PopBack(ALARM_NODE_T ** ppList)
@@ -84,31 +72,31 @@
//µ¥Á´±íÖмäɾ³ý
void Alarm_List_Node_Deleted(ALARM_NODE_T ** ppHeadList,SYS_ALARM_VALVE_T alarm_id)
{
//   if(alarm_id != ALARM_ID_NORMAL)
//   {
//      ALARM_NODE_T * last_ptr,* now_ptr;
//      if(*ppHeadList == NULL)
//         return;
//      else
//      {
//         now_ptr = *ppHeadList;
//         while(now_ptr->alarm_list_next != NULL && now_ptr->list_data != alarm_id)
//         {
//            last_ptr = now_ptr;
//            now_ptr = now_ptr->alarm_list_next;
//         }
//         if(now_ptr->list_data == alarm_id)
//         {
//            alarm_list_cnt--;
//            if(now_ptr == *ppHeadList)
//               *ppHeadList = now_ptr->alarm_list_next;
//            else
//               last_ptr->alarm_list_next = now_ptr->alarm_list_next;
//            free(now_ptr);
//            now_ptr = NULL;
//         }
//      }
//   }
   if(alarm_id != AV_NORMAL)
   {
      ALARM_NODE_T * last_ptr,* now_ptr;
      if(*ppHeadList == NULL)
         return;
      else
      {
         now_ptr = *ppHeadList;
         while(now_ptr->alarm_list_next != NULL && now_ptr->list_data != alarm_id)
         {
            last_ptr = now_ptr;
            now_ptr = now_ptr->alarm_list_next;
         }
         if(now_ptr->list_data == alarm_id)
         {
            alarm_list_cnt--;
            if(now_ptr == *ppHeadList)
               *ppHeadList = now_ptr->alarm_list_next;
            else
               last_ptr->alarm_list_next = now_ptr->alarm_list_next;
            free(now_ptr);
            now_ptr = NULL;
         }
      }
   }
}