unilist.c
来自「The example for Boor USING MPI2」· C语言 代码 · 共 37 行
C
37 行
#include "list.h"extern char *DupString( const char * );void InsertElm( const char *key, const char *value ){ ListElm *ptr, *last_ptr, *new_ptr; int compare; /* Lock list, find insertion point, and insert element */ lock_mutex(); last_ptr = head; ptr = head->next; while (ptr) { compare = strcmp( ptr->key, key ); if (compare == 0) { /* Duplicate key. Ignore */ unlock_mutex(); return; } if (compare > 0) { break; } last_ptr = ptr; ptr = ptr->next; } /* Create new element */ if ( !(new_ptr = (ListElm *)malloc( sizeof(ListElm) )) ) abort(); new_ptr->key = DupString( key ); new_ptr->value = DupString( value ); new_ptr->next = ptr; last_ptr->next = new_ptr; unlock_mutex();}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?