Giter Club home page Giter Club logo

stringmanage_v2's Introduction

相对于stringmanage_v1,有如下变化:
1)分配表g_add_table, g_del_table 
  由原来的一维数组管理,改为了结构体数组管理
 
2)原有用大数组存放字符的方法,因为malloc的引入,而有如下几种:
  a) NO_USE_MALLOC: 原有大数组的方式
  b) USE_MALLOC_V1: 使用malloc 在一开始申请大数组,后续处理同NO_USE_MALLOC
  	            变化意义不大

  c) USE_MALLOC_V2: 已删除空间可再分配。
	            所以每次添加字符串时,可能需要malloc,
	            也可能对g_del_table中已删除空间再利用。
                    每次删除字符串时,不立即进行free, 采用g_del_table进行			      维护

                    g_add_table, g_del_table中的记录在进程退出前集中free.
	            (take care of this )

  d) USE_MALLOC_V3: 完全的采用malloc 和free.
                    每次删除字符串时,直接进行free掉,不进行再分配。

3) 针对上面几种情况,利用条件编译,将其整合到一份代码中。

4) 这样,对于代码的维护可能带来不便,也可能有隐含的Bug. 
   
5) 有后续的项目开发需求,如学生信息管理系统,希望可对此代码进行重用。

Enjoy yourself.

 

stringmanage_v2's People

Contributors

wushenwu avatar

Watchers

James Cloos avatar  avatar

Forkers

958724723

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.